comp.lang.ada
 help / color / mirror / Atom feed
From: "Anh Vo" <Anh.Vo@baesystems.com>
To: <comp.lang.ada@ada-france.org>
Subject: Re: Simulating OS semaphore behavior
Date: Thu, 31 Aug 2006 11:24:05 -0500
Date: 2006-08-31T18:25:17+02:00	[thread overview]
Message-ID: <mailman.28.1157041485.32700.comp.lang.ada@ada-france.org> (raw)

>>> "REH" <spamjunk@stny.rr.com> 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 



             reply	other threads:[~2006-08-31 16:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-31 16:24 Anh Vo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-08-25 15:00 Simulating OS semaphore behavior REH
2006-08-25 15:09 ` Dmitry A. Kazakov
2006-08-25 15:25   ` REH
2006-08-25 17:31   ` Jean-Pierre Rosen
2006-08-26  8:39     ` Dmitry A. Kazakov
2006-08-26 13:34       ` REH
2006-08-26 13:42         ` jimmaureenrogers
2006-08-27 14:00           ` Simon Wright
2006-08-26 20:18         ` Dmitry A. Kazakov
2006-08-26 20:29           ` REH
2006-08-27 17:07             ` Dmitry A. Kazakov
2006-08-27 18:02             ` Simon Wright
2006-08-27 22:28               ` REH
replies disabled

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