Bypassing std.concurrency.exec()

Don Viszneki via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 22:16:57 PDT 2014


I am using SDL2 for audio output. SDL2 creates its own thread 
which will periodically invoke my callback when the audio sink 
needs more samples.

I want to use std.concurrency.receiveTimeout() with this thread, 
however I get a segfault when attempting to receive a message:

http://pastebin.mozilla.org/5849384

Upon further investigation, it looks like this function depends 
on the TLS variable std.concurrency.mbox, which is marked 
private. (This is not strictly the same variable as 
std.concurrency.Tid.mbox.)

I think the problem can be found by examining the private 
function std.concurrency._spawn(), which is the only place where 
std.concurrency.mbox is assigned to, except for in 
std.concurrency.thisTid().

My thinking on this is probably wrong, however, as adding a call 
to thisTid() does not fix the problem.

If anyone has any ideas, I'd be happy to hear them.

I'm using a really old DMD but I have compared the 
std.concurrency module from my GDC 4.9.0 with the latest from 
Github Phobos and they look substantially the same with respect 
to my issue.

Any help would be greatly appreciated!


More information about the Digitalmars-d mailing list