'importing' threads — i.e. thread_attachThis()

Guillaume Piolat via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 12 12:21:03 PDT 2016


On Friday, 12 August 2016 at 18:59:35 UTC, Guillaume Piolat wrote:
> - Callback case:
> You may have problems if one of the registered thread is 
> destroyed outside of your program and then the GC tries to stop 
> it though. For this reason if you are in the callback case you 
> can try to detach it on exit.

For anyone reading this, consider using a RAII struct in the case 
of a foreign callback (typically: shared library). You can find 
one ready-to-use here: 
https://github.com/AuburnSounds/dplug/blob/master/core/dplug/core/runtime.d#L92


More information about the Digitalmars-d-learn mailing list