On Mon, Feb 04, 2008 at 11:44:48PM +0330, Mostafa Razavi wrote:
Hi. I've been thinking about Hunchentoot's thread safety, lately. I see that for each request Hunchentoot spawns a new thread (if possible, of course) and binds the special variable *request* for it. Initially I thought this could cause problems, but when I did a few tests I found out everything actually seems to work correctly.
Now, I'm not complaining why things are not going wrong, only I'm curious how is it that using a dynamic variable, which is one of those dreaded global variables after all, does not cause problems here.
Special variables are global variables done right, and aren't to be dreaded in Common Lisp.
In threaded Lisps, binding a special will typically make it thread-local. For example, in SBCL:
http://www.sbcl.org/manual/Special-Variables.html
Zach