diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:54:52 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 22:54:52 +0000 |
commit | 6a6e657234868ad4044b03bdeb9c6f7e872b5ee6 (patch) | |
tree | 36d9855863e1cf5615b62623b2347ec494447cdb /base/message_loop.cc | |
parent | 15e8abe105f4c2a08cd5dc51e95ec1791ac440f2 (diff) | |
download | chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.zip chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.tar.gz chromium_src-6a6e657234868ad4044b03bdeb9c6f7e872b5ee6.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@1122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index caec847..bdf99f0 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -39,7 +39,9 @@ // a TLS index to the message loop for the current thread // Note that if we start doing complex stuff in other static initializers // this could cause problems. -/*static*/ TLSSlot MessageLoop::tls_index_ = ThreadLocalStorage::Alloc(); +// TODO(evanm): this shouldn't rely on static initialization. +// static +TLSSlot MessageLoop::tls_index_; //------------------------------------------------------------------------------ @@ -83,7 +85,7 @@ MessageLoop::MessageLoop() exception_restoration_(false), state_(NULL) { DCHECK(!current()) << "should only have one message loop per thread"; - ThreadLocalStorage::Set(tls_index_, this); + tls_index_.Set(this); // TODO(darin): Generalize this to support instantiating different pumps. #if defined(OS_WIN) pump_ = new base::MessagePumpWin(); @@ -100,7 +102,7 @@ MessageLoop::~MessageLoop() { WillDestroyCurrentMessageLoop()); // OK, now make it so that no one can find us. - ThreadLocalStorage::Set(tls_index_, NULL); + tls_index_.Set(NULL); DCHECK(!state_); |