Is synchronized(mutex) == mutex.lock()?
Heywood Floyd
soul8o8 at gmail.com
Wed Jul 14 20:22:20 PDT 2010
Hi!
Breakfast toast: Is there any chance a) and b) below are identical in what they do?
auto mutex = new Mutex();
auto cond = new Condition(mutex);
// a)
synchronized(mutex){
cond.wait();
}
// b)
mutex.lock();
cond.wait();
mutex.unlock();
I was sprinkling my code with mutex.lock/unlock (for fun) when suddenly I realized that, hey, maybe synchronized would work just as well, and be even more fun? (If that's even possible.)
BR
/HF
More information about the Digitalmars-d-learn
mailing list