[hunchentoot-devel] Hunchentoot Thread Safety

Zach Beane xach at xach.com
Mon Feb 4 20:21:09 UTC 2008


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



More information about the Tbnl-devel mailing list