[DGD]Kernel mudlib question: What's TLS?

Erwin Harte harte at xs4all.nl
Wed May 23 01:02:51 CEST 2001


On Tue, May 22, 2001 at 05:39:03PM -0400, Cathy Willey wrote:
> I've been poking through the kernel mudlib with the goal of building my own
> extensions onto it, and have one nagging, probably stupid, question:
> 
> What exactly is TLS? I see a lot of support for it in the kernel, but
> nothing actually uses it, as far as I can tell (I checked - there's a lot of
> 'tls' variables declared and allocated, but no calls to set_tlvar() or
> get_tlvar() ). And there's no documentation on it - so I'm not quite sure what,
> exactly, it's supposed to do for me and why I might want to use it. 
> 
> Can someone offer a brief explanation of the system?

TLS = Thread-local-storage.

The idea is to have a storage-place that is unique for each thread but
without the use of one global object.  The reason for that is that
such a global object would cause multiple threads to 'abort' eachother
when they both want to modify data in the same object, while the
individual TLS can be modified by the relevant threads without causing
such conflicts.

Hope this helps,

Erwin.
-- 
Erwin Harte <harte at xs4all.nl>

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list