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

Steven Schveighoffer schveiguy at yahoo.com
Thu May 31 11:35:50 PDT 2012


On Thu, 31 May 2012 14:29:27 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 5/31/12 7:01 AM, Regan Heath wrote:

>> Sorry, I have no spare time to spare. You're getting free ideas/thoughts
>> from me, feel free to ignore them.
>
> Thanks. Let me know if I understand correctly that your idea boils down  
> to "I don't like synchronized, let's deprecate it and get back to  
> core.sync.mutex and recommend the private thingamaroo." In that case, I  
> disagree. I believe synchronized has good merits that are being ignored.

No, this is definitely *not* what we are saying.  The idea is that  
synchronized(x) is still present, but what objects you can call this on,  
and more importantly, *who* can do this is restricted.

Nobody is advocating abandoning synchronized in favor of manual locks.  In  
fact, I think we all want to *avoid* manual locks as much as possible.   
It's all about controlling access.  If it comes down to "you must use a  
private, error-prone mutex member in order to prevent deadlocks," then I  
think we have room for improvement.

-Steve


More information about the Digitalmars-d mailing list