Reputation: 105
I'm new to Ada but not new to programming in general. I have a problem with protected data objects. As I understood from examples and books is that you can make a call for a member in the protected data object just as you would with a task.
Here is my code :
procedure ass4 is
protected type Signal_Object is
entry Wait;
procedure Signal;
function Is_Open return Boolean;
private
Open : Boolean := False;
end Signal_Object;
protected body Signal_Object is
entry Wait when Open is
begin
Open := False;
end Wait;
procedure Signal is
begin
Open := True;
end Signal;
function Is_Open return Boolean is
begin
return Open;
end Is_Open;
end Signal_Object;
begin
Signal_Object.Signal;
end;
However the compiler doesn't like the call Signal_Object.Signal;
and I get the following error
invalid use of subtype mark in expression or call
So what am I missing ?
Upvotes: 2
Views: 4379
Reputation: 6430
You have a protected type, not a protected object. Either change the declaration from
protected type Signal_Object is
to
protected Signal_Object is
or declare an object of the type
My_Signal_Object : Signal_Object;
and then make your call to the object
My_Signal_Object.Signal
Upvotes: 5