diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 21:47:40 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 21:47:40 +0000 |
commit | c3ec35638ea6594b6bdbac7ff92c38add8984623 (patch) | |
tree | c51541ac2451e66c410b3d244e1f59ac2218c57e /base/thread.cc | |
parent | e537c3515e270527ba2fa54fcfc4a1ed49cc975e (diff) | |
download | chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.zip chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.tar.gz chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.tar.bz2 |
TrackedObjects assumes you can use a "TLS slot" of -1 to indicate uninitialized. This isn't true for the pthread_key_t type, which is unsigned on Linux and reportedly a struct on Macs. This change modifies the Slot type to be a struct containing an "initialized" flag.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/thread.cc')
-rw-r--r-- | base/thread.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/thread.cc b/base/thread.cc index 629c7e0..6998deb 100644 --- a/base/thread.cc +++ b/base/thread.cc @@ -69,7 +69,6 @@ Thread::Thread(const char *name) thread_id_(0), message_loop_(NULL), name_(name) { - DCHECK(tls_index_) << "static initializer failed"; } Thread::~Thread() { @@ -82,18 +81,19 @@ Thread::~Thread() { // Thread to setup and run a MessageLoop. // Note that if we start doing complex stuff in other static initializers // this could cause problems. -TLSSlot Thread::tls_index_ = ThreadLocalStorage::Alloc(); +// TODO(evanm): this shouldn't rely on static initialization. +TLSSlot Thread::tls_index_; void Thread::SetThreadWasQuitProperly(bool flag) { #ifndef NDEBUG - ThreadLocalStorage::Set(tls_index_, reinterpret_cast<void*>(flag)); + tls_index_.Set(reinterpret_cast<void*>(flag)); #endif } bool Thread::GetThreadWasQuitProperly() { bool quit_properly = true; #ifndef NDEBUG - quit_properly = (ThreadLocalStorage::Get(tls_index_) != 0); + quit_properly = (tls_index_.Get() != 0); #endif return quit_properly; } |