Re: Need info about Ada tasks



On Thu, 25 Sep 2008 15:49:28 +0200, "Dmitry A. Kazakov"
<mailbox@xxxxxxxxxxxxxxxxx> 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.
.



Relevant Pages

  • Re: select delay; then abort... in Annex E
    ... have thought the abort would happen as soon as it completes ... it's a real nuisance if any remote call can ... subsequent delay statements in the task take minimal time, ... end loop; ...
    (comp.lang.ada)
  • Re: select delay; then abort... in Annex E
    ... have thought the abort would happen as soon as it completes ... it's a real nuisance if any remote call can ... subsequent delay statements in the task take minimal time, ... end loop; ...
    (comp.lang.ada)
  • Re: Asynchronous abort not working in Debian GNAT?
    ... After upgrading to Debian Lenny, FSF GNAT 4.3.2, it appears that this no ... example "delay 0.0" or Text_IO output to the console. ... FWIW, with Windows GNAT GPL 2007, it doesn't abort either, ... end loop Very_Busy; ...
    (comp.lang.ada)
  • Need info about Ada tasks
    ... I am using the MingW Ada compiler and the GWindows packages on Windows ... 2000 and lists its rows to a visible screen display. ... I need to be able to abort the ... how do I bail out in the middle of a delay? ...
    (comp.lang.ada)
  • Re: Need info about Ada tasks
    ... doesn't arrive on time I get another iteration of the loop before the ... How can I make this thing abort immediately, ... have a delayto give a 1-minute delay between display refreshes? ... how do I bail out in the middle of a delay? ...
    (comp.lang.ada)