Proposal: adding condition variable to object monitors

Sean Kelly sean at invisibleduck.org
Sun Mar 15 08:43:09 PDT 2009


They're already in druntime for D2, though they haven't been distributed 
yet (dunno why).  And they can act like they're built in:

class C
{
     Mutex     m;
     Condition c;

     this()
     {
         // make m this object's monitor
         m = new Mutex( this );
         c = new Condition( m );
     }

     synchronized void foo()
     {
         // m is locked
         c.notify();
     }
}



More information about the Digitalmars-d mailing list