[Openmcl-devel] process-run-function and "dynamic vs lexical"
james.anderson at setf.de
Thu Oct 22 18:27:10 UTC 2009
[something makes me wonder, that's mr dachraoui may just be testing.]
On 2009-10-22, at 19:58 , Daniel Weinreb wrote:
> Just to make sure this was clear, the difference
> between the two examples isn't whether funcall
> per se is being used; the difference is what thread
> the closure is run in. The first example runs the
> closure in another process. The symbol f
> is intepreted as a dynamic variable, and it sees
> the global value, rather than 3, because the value 3
> is specific to the main thread, and does not apply
> to the newly-created thread. Bindings of dynamic
> varaibles apply only to the thread in which they
> were bound.
the thread issue is a red-herring.
cf issues re special variables and scheduler predicates.
? (funcall (let ((x 2) (y 3))
(labels ((f () (format t "~%@~s: x=~A y=~A~%" *current-
process* x y)))
(ccl:process-run-function "test" #'f)
@#<PROCESS Listener [Running] #x3328746>: x=2 y=3
@#<PROCESS Listener [Running] #x3328746>: x=2 y=1
@#<PROCESS test [Running] #x38B5D9E>: x=2 y=1
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openmcl-devel