synchronized (this[.classinfo]) in druntime and phobos
deadalnix
deadalnix at gmail.com
Wed May 30 02:34:05 PDT 2012
Le 29/05/2012 23:33, Andrei Alexandrescu a écrit :
> On 5/29/12 1:37 AM, deadalnix wrote:
>> I would say that breaking things here, with the right deprecation
>> process, is the way to go.
>
> So what should we use for mutex-based synchronization if we deprecate
> synchronized classes?
>
> Andrei
I think something similar to range design here is the way to go.
It is easy to define something like
template isLockable(T) {
enum isLockable = isShared!T && is(typeof(T.init.lock())) &&
is(typeof(T.init.release()));
}
And allow locking only if(isLockable!Type) .
Now we can create SyncObject or any structure we want. The point is that
we lock explicit stuff.
More information about the Digitalmars-d
mailing list