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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7ef40c364905158c,start X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Neater entry point code Date: 1997/12/17 Message-ID: #1/1 X-Deja-AN: 299256222 Content-Transfer-Encoding: 8bit References: <34989E2A.93EF7271@dsto.defence.gov.au> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-12-17T00:00:00+00:00 List-Id: In article <34989E2A.93EF7271@dsto.defence.gov.au>, Mark Rutten wrote: >The code that I have at the moment looks like > > while Execute'Count /= 0 loop > > accept Execute( In_Msg: in Message_Typ ) do > Msg := In_Msg; > end Execute; > > Add_Msg(Msg); > > end loop; > > Execute_Stuff; Note that naming the in parameter "In_Msg" isn't necessary; just use an expanded name: task body My_Task_Type is Msg : Message_Typ; begin ... accept Execute (Msg : in Message_Type) do My_Task_Type.Msg := Msg; end Execute; ... As Ben pointed out, it sounds like you want a protected object in conjunction with a task. You should hardly ever use T'Count for a task type, because of the race conditions; it's pretty much a worthless attribute. If you're ever tempted to use T'Count, don't. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271