[plt-dev] Mac OS X audio creates new threads, how to call scheme code?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Apr 20 14:08:23 EDT 2010

Justin Phillips is writing code to allow Racket[*] to interact with Mac OS X MIDI events.  This OS code has the following interface, as I understand it: give me a callback, and I'll set up a new high priority thread to receive calls to this callback.

Unfortunately, as we understand it, having a separate thread call racket code is a big no-no. 

So, we have two threads running in the same process, needing to communicate.  Ideally, we'd like to avoid polling, but I'm not sure what the best strategy is. Is there an obvious choice for allowing a C thread to send a signal (perhaps just a Unix 'signal'?) to the racket threads? Could the C code manipulate a racket semaphore? I pawed through Inside PLT Scheme for a bit, but didn't find what I was looking for.

Suggestions and doc pointers much appreciated,

John Clements





[*] When should we start calling it "racket" on plt-scheme?  The only reason I sent this message to plt-dev and not to plt-scheme was because I wasn't sure about the answer to this question.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4669 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20100420/6b8c1440/attachment.p7s>

Posted on the dev mailing list.