RE: 5.0: Calling back into Lisp from foreign threads still doesn't seem to
work
> -----Original Message-----
> From: owner-lisp-hug@lispworks.com
> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Edi Weitz
> Sent: Thursday, September 21, 2006 8:55 PM
> To: lisp-hug@lispworks.com
> Subject: 5.0: Calling back into Lisp from foreign threads
> still doesn't seem to work
>
>
> Hi!
>
> I thought that one of the new features of LW 5.0 was the fact
> that one could call back into Lisp from any thread. However,
> from my experience this doesn't seem to be the case. I'm
> using an example that was originally sent to the RDNZL
> mailing list by Richard Fateman, see here:
>
>
> http://common-lisp.net/pipermail/rdnzl-devel/2005-December/000041.html
>
> It turned out this didn't work with LispWorks (4.4.6) and
> AllegroCL[*] at that time, but it did work with CormanLisp
> which seems to have another threading model.
>
> A workaround that worked for LispWorks (4.4.6, again) was to
> build a DLL. See here:
>
>
> http://common-lisp.net/pipermail/rdnzl-devel/2005-December/000044.html
>
> http://common-lisp.net/pipermail/rdnzl-devel/2006-January/000047.html
> http://weitz.de/lw-callbacks/
>
> Now, a couple of months later, LispWorks 5.0 has arrived and
> I thought that the DLL workaround wasn't needed anymore.
> Unfortunately, it still is, i.e. if I call MJNETRS2 from a
> normal LispWorks 5.0 image, it still blocks, if I call it
> from a LispWorks 5.0 DLL (built as described above), it works fine.
>
> So, am I missing something or is calling back from foreign
> threads into Lisp still something that doesn't work reliably?
Have you done 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.
I don't have 5.0 now so I can't try it, but when I get it, this feature is one I really want -- if it works.
Eivind