[Openmcl-devel] threads and special variables
bernard tatin
bernard.tatin at tele2.fr
Wed Jan 12 12:34:45 PST 2005
I wanted to do this :
-----------------------------------------
(defvar *var* nil)
(defparameter *param* nil)
(defun add-var (x)
(+ x *var*))
(defun add-param (x)
(+ x *param*))
(defun test ()
(format t "add-var 4 : ~a add-param 4 ~a ~%"
(add-var 4)
(add-param 4)))
;; it works fine
(let ((*var* 1)
(*param* 2))
(test))
;; it does not work
(let ((*var* 1)
(*param* 2))
(PROCESS-RUN-FUNCTION "test" #'test))
-----------------------------------------
The output is :
-----------------------------------------
[LeMac:cpuview] narberd% openmcl --load tests-specialvars.lisp
;; it works fine
add-var 4 : 5 add-param 4 6
;; running the process fails
> Error in process test(2): value NIL is not of the expected type NUMBER.
> While executing: CCL::+-2
;;;
;;; #<PROCESS test(2) [Reset] #x63E5DB6> requires access to Shared
Terminal Input
;;;
Welcome to OpenMCL Version (Beta: Darwin) 0.14.2-p1 CVS ccl-0.14 20041026!
?
-----------------------------------------
I understand that *var* and *param* have their initial value (nil) when
the process "test" starts. I try to use make-process and the key
argument initial-binding like that :
(make-process "test" :initial-bindings '(???))
but I don't understand what to put in the '(???).
Can you help me ?
Thanks,
Bernard.
More information about the Openmcl-devel
mailing list