On Thu, 31 Jan 2013 17:31:38 -0500, Rainer Schuetze <[email protected]>
wrote:
Any reference that is accessible from multiple threads, e.g. a global
shared variable.
shared(Container) allObjects;
Without any thread having a reference to it, the payload's reference
count is 1. The reading thread above increments the counter when making
a local copy, but the writing thread decrements the counter when
assigning Container.init. If both run concurrently, with the sequence 1
to 3 above, trouble is inevitable.
Right, but isn't that an issue with having ANY shared variable that isn't
protected by a lock?
I was thinking you had passed the pointer in via a message or something.
-Steve