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

Side by Side Diff: base/thread_local.h

Issue 3824006: base: add a thread-safety assertion checker (Closed)
Patch Set: fix function name Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // WARNING: Thread local storage is a bit tricky to get right. Please make 5 // WARNING: Thread local storage is a bit tricky to get right. Please make
6 // sure that this is really the proper solution for what you're trying to 6 // sure that this is really the proper solution for what you're trying to
7 // achieve. Don't prematurely optimize, most likely you can just use a Lock. 7 // achieve. Don't prematurely optimize, most likely you can just use a Lock.
8 // 8 //
9 // These classes implement a warpper around the platform's TLS storage 9 // These classes implement a wrapper around the platform's TLS storage
10 // mechanism. On construction, they will allocate a TLS slot, and free the 10 // mechanism. On construction, they will allocate a TLS slot, and free the
11 // TLS slot on destruction. No memory management (creation or destruction) is 11 // TLS slot on destruction. No memory management (creation or destruction) is
12 // handled. This means for uses of ThreadLocalPointer, you must correctly 12 // handled. This means for uses of ThreadLocalPointer, you must correctly
13 // manage the memory yourself, these classes will not destroy the pointer for 13 // manage the memory yourself, these classes will not destroy the pointer for
14 // you. There are no at-thread-exit actions taken by these classes. 14 // you. There are no at-thread-exit actions taken by these classes.
15 // 15 //
16 // ThreadLocalPointer<Type> wraps a Type*. It performs no creation or 16 // ThreadLocalPointer<Type> wraps a Type*. It performs no creation or
17 // destruction, so memory management must be handled elsewhere. The first call 17 // destruction, so memory management must be handled elsewhere. The first call
18 // to Get() on a thread will return NULL. You can update the pointer with a 18 // to Get() on a thread will return NULL. You can update the pointer with a
19 // call to Set(). 19 // call to Set().
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 private: 114 private:
115 ThreadLocalPointer<void> tlp_; 115 ThreadLocalPointer<void> tlp_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean); 117 DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean);
118 }; 118 };
119 119
120 } // namespace base 120 } // namespace base
121 121
122 #endif // BASE_THREAD_LOCAL_H_ 122 #endif // BASE_THREAD_LOCAL_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/thread_restrictions.h » ('j') | base/thread_restrictions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698