From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d775e66c331d34f6,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-03 12:58:40 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: shoko2004@hotmail.com (shoko) Newsgroups: comp.lang.ada Subject: protected type question Date: 3 Jan 2004 12:58:39 -0800 Organization: http://groups.google.com Message-ID: <4948f537.0401031258.62a7cdc7@posting.google.com> NNTP-Posting-Host: 217.132.89.27 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1073163520 1060 127.0.0.1 (3 Jan 2004 20:58:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 3 Jan 2004 20:58:40 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:4082 Date: 2004-01-03T12:58:39-08:00 List-Id: 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;