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

deadalnix deadalnix at gmail.com
Wed May 30 12:19:24 PDT 2012


Le 30/05/2012 19:19, Andrei Alexandrescu a écrit :
> Must've been another poster. Anyhow, in TDPL's design only synchronized
> classes can be used with the synchronized statement.
>

Which is good.

>> Such an object is known to be lockable, and most object will not be. It
>> will avoid liquid lock, because most thing will not be lockable.
>
> I'm celebrating day 2 of having no idea what a liquid lock is.
>

I just explained that in another post.

>> Combined with encapsulation capabilities that D already have, exposing
>> the lock to the entire worlds is easy. It will avoid unexpected lock
>> from 3rd party code, which is a source of tedious deadlock.
>>
>> It also open door for locking on struct, that is easily embeded in a
>> class as value (so constructed and destructed with the class).
>>
>> The fact that anyone or not can lock/unlock a mutex is a encapsulation
>> problem and we already have solution in D for that.
>
> ... which can be used with synchronized classes.
>

As said, I have nothing against synchronized classes.


More information about the Digitalmars-d mailing list