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

Side by Side Diff: base/thread_local_storage.h

Issue 552004: Style cleanup in preparation for auto-linting base/. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « base/test/test_suite.h ('k') | base/time_win.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_THREAD_LOCAL_STORAGE_H_
6 #define BASE_THREAD_LOCAL_STORAGE_H_ 6 #define BASE_THREAD_LOCAL_STORAGE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 9
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
11 #include <pthread.h> 11 #include <pthread.h>
12 #endif 12 #endif
13 13
14 // Wrapper for thread local storage. This class doesn't do much except provide 14 // Wrapper for thread local storage. This class doesn't do much except provide
15 // an API for portability. 15 // an API for portability.
16 class ThreadLocalStorage { 16 class ThreadLocalStorage {
17 public: 17 public:
18 18
19 // Prototype for the TLS destructor function, which can be optionally used to 19 // Prototype for the TLS destructor function, which can be optionally used to
20 // cleanup thread local storage on thread exit. 'value' is the data that is 20 // cleanup thread local storage on thread exit. 'value' is the data that is
21 // stored in thread local storage. 21 // stored in thread local storage.
22 typedef void (*TLSDestructorFunc)(void* value); 22 typedef void (*TLSDestructorFunc)(void* value);
23 23
24 // A key representing one value stored in TLS. 24 // A key representing one value stored in TLS.
25 class Slot { 25 class Slot {
26 public: 26 public:
27 Slot(TLSDestructorFunc destructor = NULL); 27 explicit Slot(TLSDestructorFunc destructor = NULL);
28 28
29 // This constructor should be used for statics. 29 // This constructor should be used for statics.
30 // It returns an uninitialized Slot. 30 // It returns an uninitialized Slot.
31 explicit Slot(base::LinkerInitialized x) {} 31 explicit Slot(base::LinkerInitialized x) {}
32 32
33 // Set up the TLS slot. Called by the constructor. 33 // Set up the TLS slot. Called by the constructor.
34 // 'destructor' is a pointer to a function to perform per-thread cleanup of 34 // 'destructor' is a pointer to a function to perform per-thread cleanup of
35 // this object. If set to NULL, no cleanup is done for this TLS slot. 35 // this object. If set to NULL, no cleanup is done for this TLS slot.
36 // Returns false on error. 36 // Returns false on error.
37 bool Initialize(TLSDestructorFunc destructor); 37 bool Initialize(TLSDestructorFunc destructor);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #endif // OS_WIN 85 #endif // OS_WIN
86 86
87 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage); 87 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);
88 }; 88 };
89 89
90 // Temporary backwards-compatible name. 90 // Temporary backwards-compatible name.
91 // TODO(evanm): replace all usage of TLSSlot. 91 // TODO(evanm): replace all usage of TLSSlot.
92 typedef ThreadLocalStorage::Slot TLSSlot; 92 typedef ThreadLocalStorage::Slot TLSSlot;
93 93
94 #endif // BASE_THREAD_LOCAL_STORAGE_H_ 94 #endif // BASE_THREAD_LOCAL_STORAGE_H_
OLDNEW
« no previous file with comments | « base/test/test_suite.h ('k') | base/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698