[Openmcl-devel] Equivalent of process-initial-bindings in ACL?

Ram Krishnan rkris at kriyative.net
Sun Apr 13 12:35:10 PDT 2003


On Saturday, April 12, 2003, at 07:22 PM, Gary Byers wrote:

> On Sat, 12 Apr 2003, Ram Krishnan wrote:
>
>> Hello,
>>
>> Is there something equivalent to Allegro CL's process-initial-bindings
>> in OpenMCL?
>
> There actually is in 0.14 (for which documentation is being written,
> even as we speak. Honest.)

That's wonderful. However, I ftp'ed the binary distribution of 0.14 and 
tried to use it to bootstrap from the CVS (Pre_0_14) sources but got 
the following exception in `(ccl::compile-ccl)':

;Compiling "/src/ccl/level-1/ppc-trap-support.lisp"...
 > Error in process listener(2): Unknown foreign type: :UCONTEXT
 > While executing: %PARSE-FOREIGN-TYPE
 > Type :POP to abort.
Type :? for other options.
1 >

The only definition of the UCONTEXT structure was in:

library/solaris-records.lisp:242:(defrecord ucontext

Am I missing a file somewhere?

>> I'm trying to figure out a way to have a thread inherit some dynamic
>> bindings (mostly the standard i/o streams) from its parent thread 
>> (i.e.
>> the thread from which the new thread is forked). Unfortunately, this
>> seems to be something that isn't covered by the somewhat standard MP
>> package interface.
>
> There are a handful of cases in which the CL special operator PROGV
> is useful, and this is one of them.  One way to do this is:
>
> (let* ((bindings-alist '((*a* . 1) (*b* . 2))))
>    (process-run-function "example"
>                          #'(lambda ()
>                              (progv (mapcar #'car bindings-alist)
>                                     (mapcar #'cdr bindings-alist)
>                                (format t "~&in new thread, *a* = ~s, 
> *b* = ~s"
>                                      *a* *b*)))))

The only issue with this approach is that the run-function of the new 
thread has to be instrumented using the PROGV and it also means any 
subsequent threads forked by the child thread won't get this binding 
without similar instrumentation.

The context in which I'm trying to get this dynamic binding to work is 
in a socket based communication interface between Emacs and OpenMCL 
which serves as a multi-threaded interaction channel that augments 
ILISP. The ideas is that the standard i/o streams of different threads 
can be multiplexed over a single socket connection .. much like Franz's 
ELI/LEP package. In this application, the interaction handler acts as a 
REPL of sorts but binds the *standard-output* and *standard-input* 
streams to the socket stream (actually a multiplexing stream wrapper on 
the socket stream) and then evaluates the s-expression it received from 
Emacs. Now, if that s-expression form forks a thread, I'd like that 
thread (and any threads that it might in turn fork) to inherit the 
multiplexing-stream as its standard i/o.

Ideally, I'd like to get this working under the 0.13 and 0.14 code 
bases, unless 0.14 is going to supersede 0.13 imminently.

> That's not a very compelling example, because the values (and the set 
> of
> symbols to bind) are constants.  If we replaced the constant alist with
> something like:
>
> (let* ((bindings-alist (compute-bindings-alist)))
>  ...)
>
> or
>
> (let* ((bindings-alist (compute-bindings-for '(*a* *b))))
>  ...)
>
> it might start to look like a useful mechanism.

>> Any pointers would be greatly appreciated.
>
> Hope this makes sense.

Yes, it does, thanks. I've been searching Google and the comp.lang.lisp 
archives on this subject, and it looks like it may be nearly impossible 
to come up with a portable way of achieving this "bindings inheritance" 
behavior which is a bit disheartening.

Regards,

-ram


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list