Re: sb-thread:make-thread sets thread's package to CL-USER
Stas Boukarev <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.general |
|---|---|
| Message-ID | <CAF63=13wJ=DAdCa4me2zbenVoTVgG-JL4boUVybVgPpPdwwRAw@mail.gmail.com> |
Special variable bindings between threads are independent of each other. On Wed, Jun 12, 2024 at 11:59 PM Raimondas K. <[email protected]> wrote: > The *package* value in the new thread is not NIL and not what was in the > calling thread, > so the question whether the binding was not retained or set to an > unexpected value > is not as interesting as what the behaviour should be, logically. > > > On Wed, Jun 12, 2024 at 4:41 PM Stas Boukarev <[email protected]> wrote: > >> It doesn't set anything, it just doesn't retain your binding of *pacakge* >> at the time of calling make-thread. >> >> On Wed, Jun 12, 2024 at 11:37 PM Raimondas K. <[email protected]> wrote: >> >>> I don't see this explicitly documented either way, >>> but it looks that, empirically, the *package* inside the >>> newly created thread is set to COMMON-LISP-USER. >>> >>> To demonstrate >>> (defpackage :my (:use :cl)) >>> (in-package :my) >>> >>> (defun test () >>> (format *standard-output* "in TEST thread: package ~a~%" *package*)) >>> >>> (format *standard-output* "in MAIN thread: package ~a~%" *package*) >>> >>> (sb-thread:make-thread #'test >>> :arguments '() >>> :name "test") >>> >>> SBCL 2.3.2 prints out >>> in MAIN thread: package #<PACKAGE "MY"> >>> in TEST thread: package #<PACKAGE "COMMON-LISP-USER"> >>> >>> Not sure if this is how it is supposed to work; I find this >>> behaviour counterintuitive, c/w for instance, with (load "file"). >>> >>> =R. >>> >>> >>> _______________________________________________ >>> Sbcl-help mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/sbcl-help >>> >> _______________________________________________ Sbcl-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-help