Druntime and non-D threads

Nemanja Boric 4burgos at gmail.com
Fri Dec 8 10:54:44 UTC 2017


On Friday, 8 December 2017 at 09:33:03 UTC, Ali Çehreli wrote:
> 5) We depend on SIGUSR1 (and SIGUSR2, which may not be 
> necessary but it's a different topic) to suspend non-D threads. 
> Does that work with all threads? What if the calling framework 
> has other uses for those signals? Would we be interfering with 
> them?
>

As the signal handlers are setup per-process, having the non-D 
threads setup `SIGUSR1/2` will probably screw the entire GC, not 
just for these threads. I feel you must ensure that the non-D 
threads don't try to setup these handlers after the `rt_init` 
(which in turns calls `thread_init`) is called, otherwise you're 
screwed. This is also valid in inverse - you shouldn't use 
SIGUSR1/2 in non-D threads, since after calling `rt_init` the 
signal handlers will be replaced with druntime's ones.


More information about the Digitalmars-d mailing list