comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Freezing a task
Date: Thu, 17 Nov 2011 18:27:28 +0000
Date: 2011-11-17T18:27:28+00:00	[thread overview]
Message-ID: <m2fwhma9kf.fsf@pushface.org> (raw)
In-Reply-To: mzm6z5dir1ee$.1b36kl4upye4x$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Thu, 17 Nov 2011 16:00:17 +0000, Simon Wright wrote:
>
>> "Rego, P." <pvrego@gmail.com> writes:
>> 
>>> Is there a more elegant way to do this? Maybe some procedure
>>> My_Task.FreezeNow in a unknown (by me) package? Thanks
>> 
>> Well, you could do it in the debugger :-)
>> 
>> Programmatically, no. Your choices for inter-task comms are (a) the
>> rendezvous, (b) polling some shared resource (eg a protected object),
>> (c) something using sockets.
>> 
>> Or you could unilaterally abort the task, which would be the end of it.
>> 
>> For (a), maybe something like
>> 
>> loop
>>    select
>>       accept Pause;
>>       accept Continue;
>>    else
>>       null;
>>    end select;
>>    --  do stuff
>> end loop;
>
> If using select statement for accepting entry calls then:
>
>    Paused : Boolean := False;
> begin
>    loop
>       if Paused then
>          accept Release;
>          Paused := False;
>       else
>          select
>             accept Pause;
>             Paused := True;
>          else
>             ... -- Do stuff
>          end select;
>       end if;
>    end loop;

OK, but mine works too as long as you treat it with care! (BTW I agree
about the protected object being a better choice)



  parent reply	other threads:[~2011-11-17 18:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17 15:33 Freezing a task Rego, P.
2011-11-17 16:00 ` Simon Wright
2011-11-17 16:22   ` Dmitry A. Kazakov
2011-11-17 16:53     ` Dmitry A. Kazakov
2011-11-17 18:27     ` Simon Wright [this message]
2011-11-18  1:23     ` Rego, P.
2011-11-18  6:04       ` Jeffrey Carter
2011-11-18  8:47       ` Dmitry A. Kazakov
2011-11-18 10:05         ` Simon Wright
2011-11-18 11:41           ` Georg Bauhaus
2011-11-18 13:42             ` Dmitry A. Kazakov
2011-11-17 16:00 ` Dmitry A. Kazakov
2011-11-17 16:53   ` stefan-lucks
2011-11-17 17:08     ` Dmitry A. Kazakov
2011-11-17 17:13 ` Adam Beneschan
2011-11-17 18:01   ` AdaMagica
2011-11-18  1:22   ` Rego, P.
2011-11-17 17:34 ` Jeffrey Carter
2011-11-18  1:34   ` Rego, P.
2011-11-18  8:56     ` Dmitry A. Kazakov
2011-11-18  7:24 ` anon
2011-11-18 22:25   ` Anh Vo
2011-11-19  7:37     ` anon
2011-11-22  1:58   ` Rego, P.
replies disabled

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