[Feature request] Callbacks that can be called from foreign threads.
Currently there is no simple way to define a callback that is callable from a foreign thread. It would be nice if it was possible.
A simple callback results in the following crash:
Internal thread error in:
pthread_getspecific() failed.
[2: No such file or directory]
;;; ECL C Backtrace
;;; /usr/local/lib/libecl.so.23.9(_ecl_dump_c_backtrace+0x2c) [0x7f11c860d10c]
;;; /usr/local/lib/libecl.so.23.9(ecl_thread_internal_error+0x3f) [0x7f11c85fa79f]
;;; /usr/local/lib/libecl.so.23.9(+0x23cbb9) [0x7f11c863cbb9]
;;; /usr/local/lib/libecl.so.23.9(+0x228ad8) [0x7f11c8628ad8]
;;; /lib/jvm/java-20-openjdk-amd64/lib/server/libjvm.so(+0xe44320) [0x7f1192044320]
[ lines omitted ]
;;; /lib/x86_64-linux-gnu/libc.so.6(+0x11e0d0) [0x7f11c811e0d0]
Did you forget to call `ecl_import_current_thread'?
Exitting thread.
My use-case is writing a CFFI wrapper for Java Native Interface. It allows to implement native methods using C/C++ language. Using callbacks it is possible to implement those directly in lisp, however on ECL such methods would only be callable from lisp-side threads.