From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,25642dc8f94534f6 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!news.musoftware.de!wum.musoftware.de!news.tornevall.net!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Basic question about select Date: Wed, 28 Apr 2010 17:20:58 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <1p2m3s7y70lsa$.79fl3we9edva$.dlg@40tude.net> NNTP-Posting-Host: e93672d5b72365d6b95d8124fb9545ea Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 0ade6e3b932ba3f8d0b7b73adf93593a X-Complaints-To: abuse@tornevall.net X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-Validate-Post: http://news.tornevall.net/validate.php?trace=0ade6e3b932ba3f8d0b7b73adf93593a X-SpeedUI: 1738 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie User-Agent: Thunderbird 2.0.0.24 (X11/20100411) X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news2.google.com comp.lang.ada:11243 Date: 2010-04-28T17:20:58-07:00 List-Id: 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