is it possible synchronized(null) ? i.e NO-OP

Ali Çehreli acehreli at
Fri Aug 26 20:13:27 UTC 2022

On the main forum, Paul Backus proposed a nested function as well as a 
scoped lock.

On 8/26/22 10:13, mw wrote:

 >    Object lock = (a particular condition) ? realLock : null;

And I want to point out that "a particular condition" must not change 
between the check above and the following synchronized statement.

 >    synchronized(lock) {
 >      // lots of complex code block here
 >    }


More information about the Digitalmars-d-learn mailing list