On Wednesday, 3 December 2014 at 22:53:48 UTC, ponce wrote:
I have a DLL written in D that gets called by two different threads, created by a non-D host program (audio plugin). I did not create those threads, but my understanding is that they get "attached" to the D runtime.

Thread A is a real-time callback and should not ever block. @nogc seems perfect for this.

Thread B and it's impractical to make it @nogc.

How to ensure that a collection triggered by thread B never stop thread A in stop the world collections?

I assume you are referring to Windows and I have no good answer for you. Could it not vary between implementations or is it language defined? However, a real time thread ought to be specified by the OS as being non-interruptable (but with a timeout). Otherwise it should not be labeled as realtime… AudioUnits on OS-X are called with realtime priority.

IRRC the D GC uses SIGUSR1 on unix, so there you should be able to specify a signal mask to tell the OS whether to block the thread on collection or not.

Reply via email to