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

Alex Rønne Petersen alex at lycus.org
Tue May 29 14:50:34 PDT 2012


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.

I think the vtable infrastructure as templates/mixins is an orthogonal 
point.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list