Hello. (2010/12/10 17:18), Rainer Schuetze wrote:
I tried your code with the additions, and it works (dmd-2.050 on XP/32).
Oh, Sorry. It didn't work on Vista/64 (dmd-r795, druntime-r444 and Phobos-r2217).
If you are on some 64-bit system: I've seen threads without any TLS set up at all. If you check the disassembly at the crash location, and there is a read from FS:[0x2c] that results in 0, then you are probably hitting this problem.
I don't know the assembly...
It is rather delicate to modify the windows TLS data structures, so an option might be to not touch any TLS in the waveInProc (including any memory allocations), but to just set an event to notify another thread that has been created with "new Thread".
I understood that any memory allocations were not possible in these functions.
Though I wanted to use std.concurrency.send, but it is impossible. Thank you.