[cffi-devel] Thread callback problem

Bodhi bodhi at 5263.org
Wed Jun 17 00:23:50 UTC 2009


Hi,

I'm trying to write a wrapper to Apple's CoreMIDI framework with CFFI. 
CoreMIDI midi input is callback based, the framework creates a thread 
for you and then calls your given callback on that thread. I wrapped the 
necessary functions but whenever my program receives midi it crashes to 
the ldb debugger with a bus error (signal 10). After digging around for 
a while I came across the following thread:

http://common-lisp.net/pipermail/cffi-devel/2009-May/003121.html


According to the thread I can't callback into lisp on a non-lisp-created 
  thread. Is there anyway to 'bless' a thread so i can callback to lips? 
Or is the only way to  buffer the input in the C thread and then access 
it from a separate lisp thread? (I'm a lisp beginner using SBCL by the 
way.)

Maybe it would be nice to put a note in the callback part of the CFFI 
manual warning about this gotcha?

Thanks for any help or pointers,
Bodhi




More information about the cffi-devel mailing list