External threads calling into D code

George Sapkin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 17 18:43:58 PDT 2014


So, me and my threads again :)

I have some threads being created by libuv using start_thread() 
from libpthread calling into D code. D code (after some help from 
this forum) has been properly shared and when called from D 
threads and tasks works correctly. However when called by libuv 
from outside throws a segmentation fault when creating new 
dynamic array above certain size. The signal is from 
gc.Gcx.fullcollect() from libphobos2.

I've figured that could be caused by GC not being enabled in 
threads not managed by D runtime, so I tried to GC.enable() when 
in a new thread and now it seems to work. Is that expected 
behavior and a correct solution? Thanks.


More information about the Digitalmars-d-learn mailing list