From: Vladimir T. <vtz...@gm...> - 2009-11-02 19:14:59
|
On 11/2/09, Don Cohen <don...@is...> wrote: > Sam Steingold writes: > > > * Don Cohen <qba...@vf...3-vap.pbz> [2009-11-01 17:41:30 > -0800]: > > > Why is the variable C unbound in the thread when the initial bindings > > > list seems to contain a value for it? > > because initial-bindings are for global specials: > I don't see anything about this in the doc. > What's the difference between a global special and any other kind? defparameter, defvar and proclaimed specials cause per value cell to be allocated for symbols. Special variables may have different bindings in different threads. > How does :initial-bindings compare to something like > (let ((vars '(a b c))(vals (list a b c))) > (mt:make-thread > (lambda () > (progv vars vals ...)))) If A, B and C are not special variables they will not have per thread allocated value cells - bindings that progv will establish will be shared between all threads (values of A,B and C in all threads will be the same). Note also that vars and vals values will be shared between two threads (in case above it's not important) - in order to avoid this (let ((vars vars) (vals vals)) (mt:make-thread ...)) may be used. |