diff options
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 6998deb..629c7e0 100644 --- a/base/thread.cc +++ b/base/thread.cc @@ -69,6 +69,7 @@ Thread::Thread(const char *name) thread_id_(0), message_loop_(NULL), name_(name) { + DCHECK(tls_index_) << "static initializer failed"; } Thread::~Thread() { @@ -81,19 +82,18 @@ 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. -// TODO(evanm): this shouldn't rely on static initialization. -TLSSlot Thread::tls_index_; +TLSSlot Thread::tls_index_ = ThreadLocalStorage::Alloc(); void Thread::SetThreadWasQuitProperly(bool flag) { #ifndef NDEBUG - tls_index_.Set(reinterpret_cast<void*>(flag)); + ThreadLocalStorage::Set(tls_index_, reinterpret_cast<void*>(flag)); #endif } bool Thread::GetThreadWasQuitProperly() { bool quit_properly = true; #ifndef NDEBUG - quit_properly = (tls_index_.Get() != 0); + quit_properly = (ThreadLocalStorage::Get(tls_index_) != 0); #endif return quit_properly; } |