summaryrefslogtreecommitdiffstats
path: root/base/message_loop.cc
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 21:47:40 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 21:47:40 +0000
commitc3ec35638ea6594b6bdbac7ff92c38add8984623 (patch)
treec51541ac2451e66c410b3d244e1f59ac2218c57e /base/message_loop.cc
parente537c3515e270527ba2fa54fcfc4a1ed49cc975e (diff)
downloadchromium_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/message_loop.cc')
-rw-r--r--base/message_loop.cc8
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_);