Special vars and threads.
Hi all,
I'm hoping that someone can clear up my confusion regarding
special variables and threads.
My understanding is that running the following should print
'*my-var* is T' to standard out. I seem to think the binding
of *my-var* at this point will be the binding for the
process being created.
(defvar *my-var* nil)
(defun test-it ()
(mp:process-run-function
"Test" nil
#'(lambda ()
(format #.*standard-output* "*my-var* is ~A.~%" *my-var*))))
(let ((*my-var* t))
(test-it))
The only reason I can think of is that mp:process-run-function
doesn't invoke the lambda form itself but puts it onto some
sort of stack which then schedules it to run, at which point
my binding of *my-var* is not in effect.
Is this correct, and if it is then is there a way to achieve
the same effect?
Thanks,
Sean.
--
"My doctor says that I have a malformed public-duty gland and a
natural deficiency in moral fibre," he muttered to himself, "and
that I am therefore excused from saving Universes."
- Life, the Universe, and Everything Douglas Adams.