A Refcounted Array Type

via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 27 03:09:14 PST 2015


On Thursday, 26 February 2015 at 23:04:28 UTC, Steven 
Schveighoffer wrote:
> 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.

By "disallowed", I indeed mean "banned". Unfortunately, something 
that's just banned will sooner or later be used by someone, 
unless it's also statically prevented by the compiler.


More information about the Digitalmars-d mailing list