summaryrefslogtreecommitdiffstats
path: root/base/thread_local_storage_posix.cc
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 22:11:47 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 22:11:47 +0000
commitfa87a2527ca8c0bcef92d8e44791332782936911 (patch)
tree04dc5d1e6881f8356f91203a386648057b20d924 /base/thread_local_storage_posix.cc
parent4f64d0af5908e36d356c834005d08cca98d579fe (diff)
downloadchromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.zip
chromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.tar.gz
chromium_src-fa87a2527ca8c0bcef92d8e44791332782936911.tar.bz2
Revert. Failing unit tests.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/thread_local_storage_posix.cc')
-rw-r--r--base/thread_local_storage_posix.cc38
1 files changed, 11 insertions, 27 deletions
diff --git a/base/thread_local_storage_posix.cc b/base/thread_local_storage_posix.cc
index 7c24e59..bcc982f 100644
--- a/base/thread_local_storage_posix.cc
+++ b/base/thread_local_storage_posix.cc
@@ -31,39 +31,23 @@
#include "base/logging.h"
-ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
- : initialized_(false) {
- Initialize(destructor);
-}
-
-bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) {
- DCHECK(!initialized_);
- int error = pthread_key_create(&key_, destructor);
- if (error) {
+TLSSlot ThreadLocalStorage::Alloc(TLSDestructorFunc destructor) {
+ TLSSlot key;
+ int error = pthread_key_create(&key, destructor);
+ if (error)
NOTREACHED();
- return false;
- }
- initialized_ = true;
- return true;
+ return key;
}
-void ThreadLocalStorage::Slot::Free() {
- DCHECK(initialized_);
- int error = pthread_key_delete(key_);
- if (error)
- NOTREACHED();
- initialized_ = false;
+void ThreadLocalStorage::Free(TLSSlot slot) {
+ pthread_key_delete(slot);
}
-void* ThreadLocalStorage::Slot::Get() const {
- DCHECK(initialized_);
- return pthread_getspecific(key_);
+void* ThreadLocalStorage::Get(TLSSlot slot) {
+ return pthread_getspecific(slot);
}
-void ThreadLocalStorage::Slot::Set(void* value) {
- DCHECK(initialized_);
- int error = pthread_setspecific(key_, value);
- if (error)
- NOTREACHED();
+void ThreadLocalStorage::Set(TLSSlot slot, void* value) {
+ pthread_setspecific(slot, value);
}