synchronized (this[.classinfo]) in druntime and phobos

Martin Nowak dawg at dawgfoto.de
Wed May 30 22:18:06 PDT 2012


>> FWIW, I recently came across the term here:
>> http://schneide.wordpress.com/tag/liquid-lock/
>
> I explained that in another post a few minutes ago, and yes, this is it.
>
> Maybe i should write an article on that, I though it was more well known.

> The main problem here is the object the lock is acquired upon: the  
> reference of lastMessage is mutable! We call this a liquid lock, because  
> the lock isn’t as solid as it should be. It’s one of the more hideous  
> multithreading pitfalls as it looks like everything’s fine at first  
> glance.

You should try to name the real root of the bug.
It's trying to serialize access to a channel by locking the messages.

There is nothing fancy about this, it has nothing to do with mutability
it's just about locking the wrong resource.


More information about the Digitalmars-d mailing list