[Proposal] Weak reference implementation for D
Robert
jfanatiker at gmx.at
Tue Oct 15 15:09:16 PDT 2013
> Well sure, but why not use a Mutex? What does trying to sort
> out a correct lock-free algorithm gain us here?
It is not about concurrency for general purpose (phobosx.signal
is no more thread safe than std.signals), but for the GC. A
reference is hidden from the GC, when making it visible again you
get a race condition with the GC. Ensuring that you really have a
valid reference proves to be troublesome.
The problem is that destructors and thus the registered hooks for
the dispose events are called when threads are already resumed.
If this wasn't the case there would actually be no problems.
Best regards,
Robert
More information about the Digitalmars-d
mailing list