A Refcounted Array Type

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 15:04:28 PST 2015


On 2/26/15 4:40 PM, "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm at gmx.net>" 
wrote:
> On Thursday, 26 February 2015 at 18:08:28 UTC, Steven Schveighoffer wrote:
>> On 2/26/15 12:56 PM, "Marc =?UTF-8?B?U2Now7x0eiI=?=
>> <schuetzm at gmx.net>" wrote:
>>> On Thursday, 26 February 2015 at 16:51:30 UTC, Steven Schveighoffer
>>> wrote:
>>>> As talked about before, running dtors in the originating thread can
>>>> solve this problem.
>>>
>>> This probably implies forcibly destroying objects whose creating thread
>>> terminated.
>>
>> I don't think so, those objects can just be destroyed by the
>> GC-collection running thread. If the thread is no longer present,
>> there can't be a race.
>
> That's true. However, what if the destructors access global
> (thread-local) variables? Is that already disallowed?

Hm... I don't know. Is it "disallowed?" I don't think so (a simple test 
would suffice), but if any code exists today that does it, it's very 
very wrong :) I would suspect that such code should be banned.

-Steve


More information about the Digitalmars-d mailing list