Document handling of callbacks from foreign threads
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CFFI |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
Calls to functions defined via cffi:defcallback coming from foreign threads (i.e., threads not created by the Lisp implementation) is not supported in all Lisps.
Clozure CL, for example, seems to this automagically. Gary Byers described the issue
in detail in this message
<http://
Although he says "that code isn't written yet", apparently it has been
written since then.
Here's a quick test to check whether your Lisp supports callbacks from
random threads.
(in-package :cffi)
(load-foreign-
(defcallback foo :pointer ((arg :pointer))
(declare (ignore arg))
(print 'called-
(null-pointer))
(defctype pthread-t :unsigned-long)
(with-foreign-
(foreign-funcall "pthread_create" :pointer th :pointer (null-pointer)
(foreign-funcall "pthread_join" pthread-t (mem-ref th 'pthread-t)
We should at some point run it on the supported Lisps and note down
which ones support this. Then add that information to the manual and
possibly push something informative to *FEATURES* on Lisps that don't
support this.