www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - condition variable/semaphore/etc

reply Howard Berkey <howard well.com> writes:
Since D has the synchronized keyword in the language, implementing simple
mutexes and/or critical sections are straightforward and trivial.  However, I
have not found thus far any language (or phobos class) implementing something
like a condition variable.

Am I just missing it?  It's certainly possible, as I am just now being able to
dive down into D.  

CondVars (or, more easily, counting semaphores, which are useful in some
situations that condvars are) are of course implementable by anyone based on a
Mutex primitive, but it seems like they would be a good addition to the library.
Feb 09 2007
parent reply Sean Kelly <sean f4.ca> writes:
Howard Berkey wrote:
 Since D has the synchronized keyword in the language, implementing simple
mutexes
 and/or critical sections are straightforward and trivial.  However, I have not
found
 thus far any language (or phobos class) implementing something like a
 condition  variable.

There isn't one in Phobos. Tango has a locks package in the works which contains semaphores, condvars, read/write locks, and a few other things though, IIRC. If all goes as planned it should be in the next release. Sean
Feb 09 2007
parent Howard Berkey <howard well.com> writes:
That is what I had thought.  Thanks.

Sean Kelly Wrote:

 Howard Berkey wrote:
 Since D has the synchronized keyword in the language, implementing simple
mutexes
 and/or critical sections are straightforward and trivial.  However, I have not
found

 condition  variable.

There isn't one in Phobos. Tango has a locks package in the works which contains semaphores, condvars, read/write locks, and a few other things though, IIRC. If all goes as planned it should be in the next release. Sean

Feb 09 2007