From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Basic question about select
Date: Wed, 28 Apr 2010 17:20:58 -0700
Date: 2010-04-28T17:20:58-07:00 [thread overview]
Message-ID: <hrajvg$dfb$1@tornado.tornevall.net> (raw)
In-Reply-To: <li4owy33qsdk$.1h1n04y4qjtme.dlg@40tude.net>
Dmitry A. Kazakov wrote:
>
> protected Event is
> procedure Signal;
> entry Wait;
> private
> Signaled : Boolean := False;
> end Event;
>
> protected body Event is
> procedure Signal is
> begin
> Signaled := True;
> end Signal;
> entry Wait when Signaled is
> begin
> Signaled := False;
> end;
> end Event;
>
> task PID is
> entry Call;
> end PID;
>
> task body PID is
> begin
> accept Call do Event.Wait; end;
> end PID;
>
> begin
> select
> PID.Call; -- Blocked in the rendezvous
> then abort
> delay 2.0;
> Event.Signal; -- Releases the rendezvous after 2s
> end select;
>
> If abort to happen after *completion* of the rendezvous then the above
> shall not deadlock. (I checked this under GNAT/Windows, it deadlocks
> there.)
Here the call to PID.Call is not queued, but is accepted immediately, and does
not encounter an explicit requeue-with-abort. I guess that queuing on Event.Wait
does not count as equivalent to requeue-with-abort (unless this is a compiler
error; any language lawyers care to comment?). So the abortable part is never
executed, leading to deadlock.
It will be interesting to add "delay 1.0;" to the task before the accept, and
see if that changes the behavior. Then the call to PID.Call will queue, and the
abortable part should execute.
--
Jeff Carter
"From this day on, the official language of San Marcos will be Swedish."
Bananas
28
next prev parent reply other threads:[~2010-04-29 0:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-28 18:16 Basic question about select John Wilkinson
2010-04-28 18:36 ` Dmitry A. Kazakov
2010-04-28 21:00 ` Jeffrey R. Carter
2010-04-28 22:41 ` Dmitry A. Kazakov
2010-04-29 0:20 ` Jeffrey R. Carter [this message]
2010-04-29 2:16 ` Adam Beneschan
2010-04-29 4:25 ` Jeffrey R. Carter
2010-04-29 17:27 ` Adam Beneschan
2010-04-29 18:42 ` Jeffrey R. Carter
2010-04-29 0:47 ` Jeffrey R. Carter
2010-04-29 7:37 ` 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