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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue May 29 14:55:02 PDT 2012


On 5/29/12 2:50 PM, Alex Rønne Petersen wrote:
> On 29-05-2012 23:41, Andrei Alexandrescu wrote:
>> On 5/29/12 5:29 AM, Dmitry Olshansky wrote:
>>> Agreed, awfuly crippled design for a language with Thread-local by
>>> default.
>>> Looks like we have 'oh my god, what were they thinking' moment here.
>>
>> The synchronized class feature was copied by Walter from Java while he
>> at the time had only little understanding of multithreading. The
>> thread-local by default notion was added much later.
>>
>> Indeed we'd design things very differently if synchronized came about
>> later. The design of "synchronized" described in TDPL and not yet
>> implemented is a conciliation of the two.
>>
>>> If anything I'd rather re-implement the whole v-table infrastructure via
>>> mixins, templates & friends.
>>
>> Could you please elaborate how that would help multithreading?
>>
>>
>> Andrei
>>
>
> The whole concept of synchronization needs to be ripped out of Object
> with *extreme prejudice*. We have core.sync.mutex for a reason.

That's more of a restating than an elaboration.

Andrei


More information about the Digitalmars-d mailing list