From: shoko2004@hotmail.com (shoko)
Subject: protected type question
Date: 3 Jan 2004 12:58:39 -0800
Date: 2004-01-03T12:58:39-08:00 [thread overview]
Message-ID: <4948f537.0401031258.62a7cdc7@posting.google.com> (raw)
i have the following package:
generic
type Message is private;
package Broadcasts is
protected type Broadcast is
procedure Send(This_Message : in Message);
procedure Send_all(This_Message : in Message);
entry wait(A_Message : out Message );
private
Message_Arrived:Boolean:=False;
The_Message:Message;
end Broadcast ;
end Broadcasts ;
----------------------------------------------------------------
package body Broadcasts is
protected body Broadcast is
entry wait(A_Message : out Message ) when Message_Arrived is
begin
if wait'Count=0 then
Message_Arrived:=False;
end if;
A_Message:=The_Message;
end wait;
procedure Send (This_Message : in Message ) is
begin
if wait'Count>0 then
Message_Arrived:=True;
The_Message:=This_Message;
end if;
end Send;
procedure send_all(This_Message : in Message )is
begin
Message_Arrived:=True;
The_Message:=This_Message;
end send_all;
end Broadcast ;
end Broadcasts;
----------------------------------------------------------------
in the main procedure i am trying to create a task
1.I get compiltaion error:"wait" not decllared in "str_broadcasts"
what am i doing wrong?
2.In the broadcasts package i use send all procedure that will free
all waiting tasks is this is the right way?
with broadcasts;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
procedure main_broadcast is
subtype message is Unbounded_String;
package str_broadcasts is new broadcasts(message);
a:message :=To_Unbounded_String("hello");
TASK messages;
task body messages is
m:message;
begin
loop
str_broadcasts.wait(a);<-- compilation error
end loop;
end messages;
begin
null;
end main_broadcast;
next reply other threads:[~2004-01-03 20:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-03 20:58 shoko [this message]
2004-01-04 0:50 ` protected type question James Rogers
2004-01-04 1:04 ` Robert I. Eachus
-- strict thread matches above, loose matches on Subject: below --
2000-12-13 23:23 Protected Type Question Beard, Frank
2000-12-12 6:43 Beard, Frank
2000-12-12 5:49 Beard, Frank
2000-12-12 10:54 ` Robert Dewar
[not found] <B6A1A9B09E52D31183ED00A0C9E0888C46992F@nctswashxchg.nctswash.navy.mil>
2000-12-12 3:39 ` tmoran
2000-12-12 1:45 Beard, Frank
2000-12-12 2:51 ` Robert Dewar
1996-03-20 0:00 Bill Pritchett
1996-03-20 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox