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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,922e1768d5791765 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Return-Path: X-Mailer: Novell GroupWise Internet Agent 6.5.6 Date: Thu, 31 Aug 2006 11:24:05 -0500 From: "Anh Vo" To: Subject: Re: Simulating OS semaphore behavior Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-OriginalArrivalTime: 31 Aug 2006 16:17:55.0143 (UTC) FILETIME=[03FD0D70:01C6CD19] X-Virus-Scanned: amavisd-new at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.8rc1 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.ada Message-ID: X-Leafnode-NNTP-Posting-Host: 88.191.17.134 Organization: Guest of ProXad - France NNTP-Posting-Date: 31 Aug 2006 18:25:17 MEST NNTP-Posting-Host: 88.191.14.223 X-Trace: 1157041517 nnrp14-1.free.fr 27382 88.191.14.223:58917 X-Complaints-To: abuse@proxad.net Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!grolier!oleane.net!oleane!feed.ac-versailles.fr!proxad.net!cleanfeed2-a.proxad.net!nnrp14-1.free.fr!not-for-mail Xref: g2news2.google.com comp.lang.ada:6433 Date: 2006-08-31T18:25:17+02:00 >>> "REH" 8/25/2006 8:25 AM >>> Dmitry A. Kazakov wrote: > That looks like a classic automatic event for multiple tasks. Make Signal > an entry: > > protected body Event is > entry Wait when Signal'Count > 0 is > begin > null; > end Wait; > entry Signal when Wait'Count = 0 is > begin > null; > end Signal; > end Event; > > Signal is blocked until all waiting tasks get released. There is no race > condition because fresh attempts to Wait are blocked if a signal is > pending. > Ah, just what I love: simple and elegant. Thank you! It is just simply beautiful, sweet and elegant solution. I had implemented similar to Jean-Pierre's. I already changed to Dmitry's implementation. This is another reason that Ada is in my heart. AV