[DGD] How does TLS work?

Petter Nyström jimorie at gmail.com
Fri Mar 23 08:43:35 CET 2007


Hello!

I am curious about TLS and how the kernel library makes it work. I am
not using the kernel library myself, so I wanted to play around with
implementing something of the kind for my own mudlib. Unfortunately I
haven't been able to succeed.

At first I believed it was as simple as to figure out a clever way of
inserting new data into the array returned by call_trace(), and that
that data would still be there to fetch with subsequent calls to
call_trace(). Not so. I am looking at the driver object of the kernel
library, and see how it passes a tls argument to a lot of functions
but then do nothing with it. Aha. So that is how it gets it into the
trace. But most threads start in the receive_message() function of the
user object, and there I see no sign of taking TLS into account. So
now I am left with the feeling that I missing something.

If anyone more educated on this matter would like to explain this TLS
thing and its implementation to me, I would like to read it.

Thanks,

Petter



More information about the DGD mailing list