Workaround for typeid access violation

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 18 07:11:42 PDT 2015


On Thu, 18 Jun 2015 12:08:10 +0000, Etienne Cimon wrote:

> On Thursday, 18 June 2015 at 11:43:18 UTC, ketmar wrote:
>> On Wed, 17 Jun 2015 22:35:12 +0000, Etienne Cimon wrote:
>>
>>> e.g. __gshared MyObj g_obj1;
>>> 
>>> Thread 1: g_obj1 = new MyObj;
>>> Thread 2: g_obj1.obj2 = new MyObj;
>>> Thread 3: write(g_obj1.obj2); <-- access violation (probably)
>>
>> so no way to anchor the whole object tree by assigning it to __gshared
>> root? sure, this will never make it into mainline.
> 
> __gshared is a little sketchy. We can have TLS GC by default by piping
> `new shared` to a shared GC. It's even safer, because then we have the
> type system helping out.
> 
> e.g. shared MyObj g_obj1;
> Thread 1: g_obj1 = new shared MyObj;
> Thread 2: g_obj1.obj2 = new shared MyObj;
> Thread 3: write(g_obj1.obj2); <-- success!

besides, wouldn't it break `std.concurrency`? (ketmar have to dig into 
code instead of asking...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150618/6ae455b9/attachment-0001.sig>


More information about the Digitalmars-d mailing list