Lisp HUG Maillist Archive

RE: Callbacks from C threads into Lisp

 

> -----Original Message-----
> From: owner-lisp-hug@lispworks.com 
> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of John Pallister
> Sent: Friday, November 03, 2006 5:31 AM
> To: lisp-hug@lispworks.com
> Subject: Callbacks from C threads into Lisp
> 
> 
> I've coded up one of the sample C programs in Lisp using 
> fli:define-foreign-callable "stream-callback" and 
> fli:make-pointer :symbol-name "stream-callback", but when I 
> run it as an .EXE and the callback is called, I get:
> 
>    Failed to find stack-no 578 stack 1c8fe70
>    Stack dump
>    [16 lines of stack data]


Use sys:setup-for-alien-threads?

>From readme-5-0.pdf:

12.6.17 Foreign callbacks from unknown threads On Windows, Mac OS X, Linux and FreeBSD, foreign code can now call into Lisp in any thread, including those that LispWorks did not create.
On Windows the new function sys:setup-for-alien-threads sets up Lisp- Works to handle calls (via foreign callables) from "alien" threads, that is threads that LispWorks did not start. This setup happens automatically in LispWorks DLLs, but if there is a call into a LispWorks executable from an alien thread before sys:setup-for-alien-threads is called, the effect is unpredictable.



Eivind


Re: Callbacks from C threads into Lisp

Fantastic! Thanks for that, now it works. FWIW, some mention of this in the User
Guide (section 14.5.1, "Native threads on Windows, Mac OS X, Linux and FreeBSD"
specifically) would be very useful.

Saved from C++ yet again... phew!

Cheers,

John :^P

Eivind Midtgård wrote:
> Use sys:setup-for-alien-threads?
--
John Pallister
john@synchromesh.com



Updated at: 2020-12-10 08:47 UTC