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

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

Issue 6729002: Base: A few more files using BASE_API (for base.dll) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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_collision_warner.h ('k') | base/threading/thread_restrictions.h » ('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) 2011 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_THREADING_THREAD_LOCAL_STORAGE_H_ 5 #ifndef BASE_THREADING_THREAD_LOCAL_STORAGE_H_
6 #define BASE_THREADING_THREAD_LOCAL_STORAGE_H_ 6 #define BASE_THREADING_THREAD_LOCAL_STORAGE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h"
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 11
11 #if defined(OS_POSIX) 12 #if defined(OS_POSIX)
12 #include <pthread.h> 13 #include <pthread.h>
13 #endif 14 #endif
14 15
15 namespace base { 16 namespace base {
16 17
17 // Wrapper for thread local storage. This class doesn't do much except provide 18 // Wrapper for thread local storage. This class doesn't do much except provide
18 // an API for portability. 19 // an API for portability.
19 class ThreadLocalStorage { 20 class BASE_API ThreadLocalStorage {
20 public: 21 public:
21 22
22 // Prototype for the TLS destructor function, which can be optionally used to 23 // Prototype for the TLS destructor function, which can be optionally used to
23 // cleanup thread local storage on thread exit. 'value' is the data that is 24 // cleanup thread local storage on thread exit. 'value' is the data that is
24 // stored in thread local storage. 25 // stored in thread local storage.
25 typedef void (*TLSDestructorFunc)(void* value); 26 typedef void (*TLSDestructorFunc)(void* value);
26 27
27 // A key representing one value stored in TLS. 28 // A key representing one value stored in TLS.
28 class Slot { 29 class BASE_API Slot {
29 public: 30 public:
30 explicit Slot(TLSDestructorFunc destructor = NULL); 31 explicit Slot(TLSDestructorFunc destructor = NULL);
31 32
32 // This constructor should be used for statics. 33 // This constructor should be used for statics.
33 // It returns an uninitialized Slot. 34 // It returns an uninitialized Slot.
34 explicit Slot(base::LinkerInitialized x) {} 35 explicit Slot(base::LinkerInitialized x) {}
35 36
36 // Set up the TLS slot. Called by the constructor. 37 // Set up the TLS slot. Called by the constructor.
37 // 'destructor' is a pointer to a function to perform per-thread cleanup of 38 // 'destructor' is a pointer to a function to perform per-thread cleanup of
38 // this object. If set to NULL, no cleanup is done for this TLS slot. 39 // this object. If set to NULL, no cleanup is done for this TLS slot.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static long tls_max_; 87 static long tls_max_;
87 static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize]; 88 static TLSDestructorFunc tls_destructors_[kThreadLocalStorageSize];
88 #endif // OS_WIN 89 #endif // OS_WIN
89 90
90 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage); 91 DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);
91 }; 92 };
92 93
93 } // namespace base 94 } // namespace base
94 95
95 #endif // BASE_THREADING_THREAD_LOCAL_STORAGE_H_ 96 #endif // BASE_THREADING_THREAD_LOCAL_STORAGE_H_
OLDNEW
« no previous file with comments | « base/threading/thread_collision_warner.h ('k') | base/threading/thread_restrictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698