RefCounted no thread-safety?

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Jan 12 12:08:17 PST 2014


12-Jan-2014 23:59, Kira Backes пишет:
> Hello,
>
>
> I was just looking at the source of std.typecons.RefCounted and it seems
> like it is not thread-safe at all, the count variable may be written
> concurrently from several threads which could cause data corruption.

It cannot. In D everything is thread-local by default.
And  shared(RefCounted!T) would most likely fail to compile.

> Is
> this correct or am I overlooking something (I’m still new to D). If it
> is correct then this should either be fixed or if it is intentional it
> should really be documented.



-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list