[cffi-devel] Threads and function pointers misunderstanding

Luís Oliveira luismbo at gmail.com
Sun May 10 21:54:19 UTC 2009


On Sun, May 10, 2009 at 9:37 PM, Benjamin Tovar <mugrido at gmail.com> wrote:
> Now, everything works nicely, unless I use threads in C (pthreads). With
> threads, the first time I call (*callback)()); it segfaults, as if the
> pointer to the function was not valid (it does get assigned). I have no
> clue of what is going on, since it seems that the threads are not
> sharing the information to the function pointer. What I am missing here?
> I have tried with both Allegro and SBCL, on a Debian "testing".

IIUC, you may only call back into Lisp within a thread that has a Lisp
stack. So, you can't invoke those callbacks from threads created in C.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list