One of the next things I wanted to cleanup is the use of Thread local storage. LLVM already provides a ThreadLocal class, so simialr to how I cleaned up the DynamicLibrary stuff to use LLVM's DynamicLibrary, I wanted to do the same with ThreadLocal.
There's a catch though. Timer makes use of pthreads' thread-local storage destructors, and this isn't supported on all platforms. I'm wondering how critical is this really? It looks like the thread local storage entry is created in Timer::Initialize(), and the only place in the code that Timer::Initialize() is called is from lldb_private::Initialize. Based on this, I actually think that maybe the fact that it's using TLS at all is just a historical carry-over and not actually necessary anymore since it's only being used from a single thread. If this is true, there's no reason to even use TLS, I could just make a static member and cleanup with a call to Timer::Shutdown(). This would solve the portability issue since TLS destructors would no longer be needed, and making porting all of our TLS code to use llvm support libraries very easy. Does this assessment seem correct? Or am I missing something?
_______________________________________________ lldb-dev mailing list lldb-dev@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev