[imp-hackers] problems with *DEFAULT-SPECIAL-BINDINGS*
Tobias C. Rittweiler
tcr at freebits.de
Sat Apr 3 11:01:21 UTC 2010
Most implementations that provide multi-threading also provide a
variable which contains an association lists for variable bindings to be
established in new threads.
I wanted to introduce the same to SBCL.
However, Gábor Melis made me aware of the following issue:
One use of *DEFAULT-SPECIAL-BINDINGS* is for libraries to establish
thread-local variable bindings to new threads by pushing onto
*DEFAULT-SPECIAL-BINDINGS*.
Howsoever, that will only affect new threads, not already running
threads.
That's a big problem for the following scenario:
Let's say your Lisp development environment is multi-threaded and allows
you to run multiple listeners at the same time. Each listener is run in
its own thread.
Now, you opened a few listeners, then loaded in this library which
pushes onto *DEFAULT-SPECIAL-BINDINGS*. Now all running listeners, when
the user uses them to call into that library, will operate on the _same_
global binding.
Hilarity ensues.
Do you have ideas on how to provide a mechanism that handles this
scenario reliably?
-T.
More information about the implementation-hackers
mailing list