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

Side by Side Diff: base/thread_local.h

Issue 2222002: Unsigned warning fix - take 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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/scoped_bstr_win_unittest.cc ('k') | build/common.gypi » ('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) 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 warpper 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
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
54 #include <pthread.h> 54 #include <pthread.h>
55 #endif 55 #endif
56 56
57 namespace base { 57 namespace base {
58 58
59 // Helper functions that abstract the cross-platform APIs. Do not use directly. 59 // Helper functions that abstract the cross-platform APIs. Do not use directly.
60 struct ThreadLocalPlatform { 60 struct ThreadLocalPlatform {
61 #if defined(OS_WIN) 61 #if defined(OS_WIN)
62 typedef int SlotType; 62 typedef unsigned long SlotType;
63 #elif defined(OS_POSIX) 63 #elif defined(OS_POSIX)
64 typedef pthread_key_t SlotType; 64 typedef pthread_key_t SlotType;
65 #endif 65 #endif
66 66
67 static void AllocateSlot(SlotType& slot); 67 static void AllocateSlot(SlotType& slot);
68 static void FreeSlot(SlotType& slot); 68 static void FreeSlot(SlotType& slot);
69 static void* GetValueFromSlot(SlotType& slot); 69 static void* GetValueFromSlot(SlotType& slot);
70 static void SetValueInSlot(SlotType& slot, void* value); 70 static void SetValueInSlot(SlotType& slot, void* value);
71 }; 71 };
72 72
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 private: 113 private:
114 ThreadLocalPointer<void> tlp_; 114 ThreadLocalPointer<void> tlp_;
115 115
116 DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean); 116 DISALLOW_COPY_AND_ASSIGN(ThreadLocalBoolean);
117 }; 117 };
118 118
119 } // namespace base 119 } // namespace base
120 120
121 #endif // BASE_THREAD_LOCAL_H_ 121 #endif // BASE_THREAD_LOCAL_H_
OLDNEW
« no previous file with comments | « base/scoped_bstr_win_unittest.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698