6 Mar 2008 saju   » (Apprentice)

Maybe I am not understanding this properly but java's threadlocal storage seems funky. Unlike in other non-java threading environments one cannot introspect a thread's local storage and retrieve the objects needed. To retrieve a thread local value one needs a reference to a ThreadLocal object which was used to create this TLS. This seems a bit funky; to retrieve a TLS value at a random point in that thread I need a reference to a global ThreadLocal object; so if I have to use a global object to grab TLS values I can just make my TLS values globals !

The only difference b/w globals and TLS is that the value of the TLS object can be unique per thread. This is cool but the inability to introspect a thread's TLS values without holding a global reference doesn't make sense. This stops me from using TLS where I am unable to add/modify globals for some reason (say I am writing callbacks for an established framework).

Ofcourse I probably didn't grok this right... maybe...

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!