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

deadalnix deadalnix at gmail.com
Thu May 31 01:56:46 PDT 2012


Le 31/05/2012 07:18, Martin Nowak a écrit :
>>> 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.

When you lock on a non final resource, you ends up with trouble at some 
point. A have wasted enough time on that type of problem to know it for 
sure.


More information about the Digitalmars-d mailing list