[Openmcl-devel] Asynchronous callback made from real-time thread

Gary Byers gb at clozure.com
Mon Jun 16 23:07:47 UTC 2003

On Sat, 31 May 2003, Letz Stephane wrote:
> >
> >Getting foreign threads to be treated like processes (making the
> >value of *CURRENT-PROCESS* meaningful, having lisp PROCESS objects
> >for them, having them show up in (ALL-PROCESSES) and :PROC, etc)
> >is harder than just allocating a TCR would be.  If your event handler
> >callback can refrain from thinking that it's running in a lisp process,
> >there isn't much new code involved in creating a TCR; getting the other
> >stuff to work would probably require some ABI changes.
> >
> Do you plan to implement the get_tcr() stuff and all what would be
> needed to implement the "complex" solution at some point?

Welcome to OpenMCL Version (Alpha: Linux) 0.14-030616!
? (defun start-pthread (callback)
    (rlet ((id :pthread_t))
     (#_pthread_create id (%null-ptr) callback (%null-ptr))
? (defcallback hello (:void)
    (format t "~&hello from process ~s" *current-process*))
? (start-pthread hello)
hello from process #<PROCESS foreign(2) [Foreign thread callback] #x353DFD9E>

It turned out that this was easier than I thought that it'd be.  This
little example isn't much of a stress test, but I stepped through the
code in a debugger a few times and everything looked OK GC/thread-wise.
As far as I can tell, a "foreign" thread looks about the same - from
both inside and out - as a lisp process created via PROCESS-RUN-FUNCTION
or equivalent.

As I've been saying for weeks now, new 0.14 binaries should be available
Real Soon; the fixes and changes necessary to make this work should be
present in those binaries.

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list