Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: base/threading/thread_local_storage.h

Issue 5986012: Move thread local stuff from base to base/threading and consistently use the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/threading/thread_local_posix.cc ('k') | base/threading/thread_local_storage_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_THREAD_LOCAL_STORAGE_H_ 5 #ifndef BASE_THREADING_THREAD_LOCAL_STORAGE_H_
6 #define BASE_THREAD_LOCAL_STORAGE_H_ 6 #define BASE_THREADING_THREAD_LOCAL_STORAGE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
11 #if defined(OS_POSIX) 11 #if defined(OS_POSIX)
12 #include <pthread.h> 12 #include <pthread.h>
13 #endif 13 #endif
14 14
15 namespace base {
16
15 // Wrapper for thread local storage. This class doesn't do much except provide 17 // Wrapper for thread local storage. This class doesn't do much except provide
16 // an API for portability. 18 // an API for portability.
17 class ThreadLocalStorage { 19 class ThreadLocalStorage {
18 public: 20 public:
19 21
20 // Prototype for the TLS destructor function, which can be optionally used to 22 // Prototype for the TLS destructor function, which can be optionally used to
21 // cleanup thread local storage on thread exit. 'value' is the data that is 23 // cleanup thread local storage on thread exit. 'value' is the data that is
22 // stored in thread local storage. 24 // stored in thread local storage.
23 typedef void (*TLSDestructorFunc)(void* value); 25 typedef void (*TLSDestructorFunc)(void* value);
24 26
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 static const int kThreadLocalStorageSize = 64; 83 static const int kThreadLocalStorageSize = 64;
82 84
83 static long tls_key_; 85 static long tls_key_;
84 static long tls_max_; 86 static long tls_max_;
85 static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize]; 87 static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize];
86 #endif // OS_WIN 88 #endif // OS_WIN
87 89
88 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage); 90 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);
89 }; 91 };
90 92
91 // Temporary backwards-compatible name. 93 } // namespace base
92 // TODO(evanm): replace all usage of TLSSlot.
93 typedef ThreadLocalStorage::Slot TLSSlot;
94 94
95 #endif // BASE_THREAD_LOCAL_STORAGE_H_ 95 #endif // BASE_THREADING_THREAD_LOCAL_STORAGE_H_
OLDNEW
« no previous file with comments | « base/threading/thread_local_posix.cc ('k') | base/threading/thread_local_storage_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698