[D-runtime] What's with core.sync.condition usage?

Sean Kelly sean at invisibleduck.org
Thu Apr 26 16:08:52 PDT 2012


On Apr 26, 2012, at 1:22 PM, Steve Schveighoffer wrote:
> 
> From: Sean Kelly <sean at invisibleduck.org>
> void put(T val) {
>     synchronized (cond.mutex) {
>         queue.pushBack(val);
>         cond.notify(); // atomically unlocks mutex on call, locks on return
>     }
> }
> Huh, I thought notify did not unlock the mutex at all (I don't see why it would need to).

Oops… you're right.  The original implementation (Hoare's) did, I believe, but the modern one does not.


More information about the D-runtime mailing list