From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Neater entry point code
Date: 1997/12/17
Date: 1997-12-17T00:00:00+00:00 [thread overview]
Message-ID: <mheaney-ya023680001712972132470001@news.ni.net> (raw)
In-Reply-To: 34989E2A.93EF7271@dsto.defence.gov.au
In article <34989E2A.93EF7271@dsto.defence.gov.au>, Mark Rutten
<Mark.Rutten@dsto.defence.gov.au> 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
<mailto:matthew_heaney@acm.org>
(818) 985-1271
next prev parent reply other threads:[~1997-12-17 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-18 0:00 Neater entry point code Mark Rutten
1997-12-17 0:00 ` Matthew Heaney [this message]
1997-12-18 0:00 ` Jean-Pierre Rosen
1997-12-18 0:00 ` Ben Brosgol
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox