[RFC] "lock" statement and "mutex" type.

Sean Kelly sean at f4.ca
Tue Mar 14 15:01:40 PST 2006


Dejan Lekic wrote:
> I think D should have mutex type and lock statement as part of D language,
> in the similar fashion as in Modula-3.
> 
> D programmer would than be able to write:
> 
> mutex myMutex;
> 
> lock (myMutex)
> {
>   doSomething();
> } else {
>   continueSomething();
> }
> 
> What do others think about this?

I'm not familar with that.  What's the behavior?  Is it a tryLock where 
the else block handles the failure?  Does the syntax account for lock 
acquisition with a timeout?  That said, I agree that D needs better 
concurrency support, and that broader mutex support is one aspect of 
this.  In particular, I'd at least like to have some way to not wait 
indefinitely for a lock to become available.


Sean



More information about the Digitalmars-d mailing list