Bypassing std.concurrency.exec()

Don Viszneki via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 6 23:04:11 PDT 2014


On Thursday, 7 August 2014 at 05:58:50 UTC, Don Viszneki wrote:
> I think perhaps I need to give D the opportunity to clean up 
> SDL2's audio thread before shutting it down?

I added a new message that is sent first to my audio thread from 
the main thread when shutting down, and then it is sent from the 
audio thread to the main thread as acknowledgement.

In audio thread:
     (MessageShutdownAudio msg)
     {
       send(mainTid, MessageShutdownAudio());
       thread_detachThis();
       SDL_PauseAudio(1);
     }

In main thread:
   send(audioTid, MessageShutdownAudio());
   receive((MessageShutdownAudio bye) { /* do nothing */ });
   SDL_CloseAudio();


More information about the Digitalmars-d mailing list