OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OS_THREAD_WIN_H_ | 5 #ifndef VM_OS_THREAD_WIN_H_ |
6 #define VM_OS_THREAD_WIN_H_ | 6 #define VM_OS_THREAD_WIN_H_ |
7 | 7 |
8 #if !defined(VM_OS_THREAD_H_) | 8 #if !defined(VM_OS_THREAD_H_) |
9 #error Do not include os_thread_win.h directly; use os_thread.h instead. | 9 #error Do not include os_thread_win.h directly; use os_thread.h instead. |
10 #endif | 10 #endif |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 MonitorWaitData* waiters_tail_; | 109 MonitorWaitData* waiters_tail_; |
110 | 110 |
111 friend class Monitor; | 111 friend class Monitor; |
112 friend class OS; | 112 friend class OS; |
113 friend unsigned int __stdcall ThreadEntry(void* data_ptr); | 113 friend unsigned int __stdcall ThreadEntry(void* data_ptr); |
114 | 114 |
115 DISALLOW_ALLOCATION(); | 115 DISALLOW_ALLOCATION(); |
116 DISALLOW_COPY_AND_ASSIGN(MonitorData); | 116 DISALLOW_COPY_AND_ASSIGN(MonitorData); |
117 }; | 117 }; |
118 | 118 |
119 | |
120 typedef void (*ThreadDestructor) (void* parameter); | |
121 | |
122 | |
123 class ThreadLocalEntry { | |
124 public: | |
125 ThreadLocalEntry(ThreadLocalKey key, ThreadDestructor destructor) | |
126 : key_(key), | |
127 destructor_(destructor) { | |
128 } | |
129 | |
130 ThreadLocalKey key() const { | |
131 return key_; | |
132 } | |
133 | |
134 | |
135 ThreadDestructor destructor() const { | |
136 return destructor_; | |
137 } | |
138 | |
139 private: | |
140 ThreadLocalKey key_; | |
141 ThreadDestructor destructor_; | |
siva
2015/10/15 22:42:48
DISALLOW_COPY_AND_ASSIGN(...);
DISALLOW_ALLOCATION
Cutch
2015/10/16 16:53:26
Added DISALLOW_ALLOCATION but not DISALLOW_COPY_AN
| |
142 }; | |
143 | |
144 | |
145 template<typename T> | |
146 class MallocGrowableArray; | |
147 | |
148 | |
149 class ThreadLocalData { | |
siva
2015/10/15 22:42:48
class ThreadLocalData : public AllStatic {
Cutch
2015/10/16 16:53:26
Done.
| |
150 public: | |
151 static void AddThreadLocal(ThreadLocalKey key, ThreadDestructor destructor); | |
152 static void RemoveThreadLocal(ThreadLocalKey key); | |
siva
2015/10/15 22:42:48
Should we make OSThread a friend class and make al
Cutch
2015/10/16 16:53:25
Done.
| |
153 | |
154 static void RunDestructors(); | |
155 | |
156 private: | |
157 static Mutex* mutex_; | |
158 static MallocGrowableArray<ThreadLocalEntry>* thread_locals_; | |
159 | |
160 static void InitOnce(); | |
161 static void Shutdown(); | |
162 | |
163 friend class OS; | |
164 }; | |
165 | |
119 } // namespace dart | 166 } // namespace dart |
120 | 167 |
121 #endif // VM_OS_THREAD_WIN_H_ | 168 #endif // VM_OS_THREAD_WIN_H_ |
OLD | NEW |