Re: Simulating OS semaphore behavior
- From: "REH" <spamjunk@xxxxxxxxxxx>
- Date: 25 Aug 2006 08:25:13 -0700
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!
REH
.
- References:
- Simulating OS semaphore behavior
- From: REH
- Re: Simulating OS semaphore behavior
- From: Dmitry A. Kazakov
- Simulating OS semaphore behavior
- Prev by Date: Re: Simulating OS semaphore behavior
- Next by Date: Re: Information On How To Use The Ada Score Compiler For Windows PC
- Previous by thread: Re: Simulating OS semaphore behavior
- Next by thread: Re: Simulating OS semaphore behavior
- Index(es):
Relevant Pages
|