By: Juho Snellman (jsnell+rwt.delete@this.iki.fi), October 25, 2006 3:59 am
Room: Moderated Discussions
Rob Thorpe (rthorpe@realworldtech.com) on 10/23/06 wrote:
>2. Variables that sit between threads have memory barriers around them
[...]
>Steel bank Common Lisp takes approach #2. The only variables that one thread can
>access/view in another thread are what Lisp calls "special variables"
>which more-or-less means global variables.
Actually that's wrong on all counts :-)
1. Specials aren't the only variables that can be shared between threads. Consider for example closures. Likewise most non-Lisp programmers would also consider the slots of a class to be instance variables, and those can also obviously be accessed from many threads.
2. As far as I know, SBCL doesn't insert any memory barriers around special variable reads or writes. (But note that SBCL also only supports threads on x86 and x86-64).
3. Special variables aren't really even more-or-less global variables. Rather they're mostly thread-local variables, except if no thread-specific binding exists for a given variable, in which case the global value will be used.
>2. Variables that sit between threads have memory barriers around them
[...]
>Steel bank Common Lisp takes approach #2. The only variables that one thread can
>access/view in another thread are what Lisp calls "special variables"
>which more-or-less means global variables.
Actually that's wrong on all counts :-)
1. Specials aren't the only variables that can be shared between threads. Consider for example closures. Likewise most non-Lisp programmers would also consider the slots of a class to be instance variables, and those can also obviously be accessed from many threads.
2. As far as I know, SBCL doesn't insert any memory barriers around special variable reads or writes. (But note that SBCL also only supports threads on x86 and x86-64).
3. Special variables aren't really even more-or-less global variables. Rather they're mostly thread-local variables, except if no thread-specific binding exists for a given variable, in which case the global value will be used.