summaryrefslogtreecommitdiffstats
path: root/base/threading/thread_local_storage.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 21:38:26 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-29 21:38:26 +0000
commite517d203425edeeb028bc1bde0e87cd90bc85c25 (patch)
tree8ef38261c5d012af326870cce243d4b55cff68e3 /base/threading/thread_local_storage.h
parent31e49a79daa2ed430cc660788f133230f868d85a (diff)
downloadchromium_src-e517d203425edeeb028bc1bde0e87cd90bc85c25.zip
chromium_src-e517d203425edeeb028bc1bde0e87cd90bc85c25.tar.gz
chromium_src-e517d203425edeeb028bc1bde0e87cd90bc85c25.tar.bz2
Make ThreadLocalStorage more posix pthread compliant
This is my first shot at cleaning up the implementation. 1) I support multiple calls to destructors, as suggested in pthread standards 2) I added volatile so that the destructors can't cause any compiler confusion if they are nulled out while a second thread is calling the list of destructors. 3) Windows already avoids producing a key which has value zero <good!>, but I added some DHECKs to make this fact more obvious. I plan to try to enforce that in the posix is similarly constrained... but that will be in a future CL. 4) I did some extra cleaning of destructor handling, so that it is plausible that TCMalloc can use this service (and not have to hack its own). The problem *was* that initialization called new, which would trigger allocation activities before a thread local heap could be setup <sigh>. This is now fixed (in this CL). I also handled the destructor calls with greater care, avoiding calling delete after all the destructors have been called (as that would re-incarnate a TCMalloc heap). This is also fixed. r=willchan BUG=105410 Review URL: http://codereview.chromium.org/8702014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading/thread_local_storage.h')
-rw-r--r--base/threading/thread_local_storage.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h
index cfac633..214b7e1 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -77,15 +77,8 @@ class BASE_EXPORT ThreadLocalStorage {
// Function to lazily initialize our thread local storage.
static void **Initialize();
- private:
- // The maximum number of 'slots' in our thread local storage stack.
- // For now, this is fixed. We could either increase statically, or
- // we could make it dynamic in the future.
- static const int kThreadLocalStorageSize = 64;
-
static long tls_key_;
static long tls_max_;
- static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize];
#endif // OS_WIN
DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);