Showing posts with label dladdr. Show all posts
Showing posts with label dladdr. Show all posts

Friday, April 4, 2008

Thread Local Storage

So, I've been wondering where exactly this magic thread storage comes from. Apparently it is just a symbol type that the thread subsystem will utilize to alloc on thread creation. That is super wacky, but is exactly what I wanted to know. Now I can write my lockless lock contention detector no problem.
__thread bool awesome = TRUE;
Using Thread Local Storage
http://docs.sun.com/app/docs/doc/817-1984/6mhm7pl2a?a=view

STT_TLS in ELF files
http://blogs.sun.com/ali/entry/inside_elf_symbol_tables

This could be complemented with symbol from pointer lookup via dladdr()
http://linux.die.net/man/3/dlopen