synchronized (this[.classinfo]) in druntime and phobos
Regan Heath
regan at netmail.co.nz
Thu May 31 02:55:38 PDT 2012
On Thu, 31 May 2012 10:48:51 +0100, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 5/31/12 2:36 AM, Regan Heath wrote:
>> On Wed, 30 May 2012 19:29:39 +0100, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>> You can have deadlocks but with synchronized you can't leak locks or
>>> doubly-unlock them. With free mutexes you have all of the above.
>>
>> I'm not suggesting using free mutexes. I'm suggesting keeping the mutex
>> private inside the object.
>
> Ergo, you are suggesting using free mutexes. Your second sentence
> destroys the first.
Depends on your definition of "free". You appear to have meant as an
instance/pointer/object even one in a class, I initially read it as
meaning as a separate object from the class you're locking. In any case,
you're right the compiler doesn't get synchronized()
statements/classes/methods wrong and a programmer can. The trade-off is
the cause of this thread of discussion.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list