comp.lang.ada
 help / color / mirror / Atom feed
From: Fionn Mac Cumhaill <invisible@hiding.from.spam>
Subject: Re: Need info about Ada tasks
Date: Fri, 26 Sep 2008 05:06:30 GMT
Date: 2008-09-26T05:06:30+00:00	[thread overview]
Message-ID: <vcrod495bs43janv0ihdf1tkvbqqt38gb4@4ax.com> (raw)
In-Reply-To: 38vvmtnic6su$.13akh3j9qqeli$.dlg@40tude.net

On Thu, 25 Sep 2008 15:49:28 +0200, "Dmitry A. Kazakov"
<mailbox@dmitry-kazakov.de> wrote:

>On Thu, 25 Sep 2008 13:31:27 GMT, Fionn Mac Cumhaill wrote:
>
>> My simple solution has a minor problem; I have a select just after the
>> display routine that receives the abort message, but if the message
>> doesn't arrive on time I get another iteration of the loop before the
>> task aborts. How can I make this thing abort immediately, even when I
>> have a delay(60.0) to give a 1-minute delay between display refreshes?
>> I.e., how do I bail out in the middle of a delay?
>
>1. If the abort event is implemented as a protected object:
>
>task body Refresh_Engine is
>begin
>   loop
>      ... -- Refresh the display
>      select -- Timed entry call
>         Abort_Event.Wait;
>         exit;
>      or delay 60.0;
>      end select;
>   end loop;
>end Refresh_Engine;
>
>2. If the abort event is signaled by an entry call:
>
>task body Refresh_Engine is
>begin
>   loop
>      ... -- Refresh the display
>      select -- Selective accept with a time out alternative
>         accept Abort_Event;
>         exit;
>      or delay 60.0;
>      end select;
>   end loop;
>end Refresh_Engine;

Many thanks - that was exactly what I needed to know.



  reply	other threads:[~2008-09-26  5:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 13:31 Need info about Ada tasks Fionn Mac Cumhaill
2008-09-25 13:49 ` Dmitry A. Kazakov
2008-09-26  5:06   ` Fionn Mac Cumhaill [this message]
2008-09-26 10:21 ` Stephen Leake
2008-09-26 12:46   ` Fionn Mac Cumhaill
2008-09-27  5:56     ` Randy Brukardt
2008-09-27  7:48       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox