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_; |
| 142 |
| 143 DISALLOW_ALLOCATION(ThreadLocalEntry); |
| 144 }; |
| 145 |
| 146 |
| 147 template<typename T> |
| 148 class MallocGrowableArray; |
| 149 |
| 150 |
| 151 class ThreadLocalData : public AllStatic { |
| 152 private: |
| 153 static void AddThreadLocal(ThreadLocalKey key, ThreadDestructor destructor); |
| 154 static void RemoveThreadLocal(ThreadLocalKey key); |
| 155 |
| 156 static void RunDestructors(); |
| 157 |
| 158 static Mutex* mutex_; |
| 159 static MallocGrowableArray<ThreadLocalEntry>* thread_locals_; |
| 160 |
| 161 static void InitOnce(); |
| 162 static void Shutdown(); |
| 163 |
| 164 friend class OS; |
| 165 friend class OSThread; |
| 166 }; |
| 167 |
119 } // namespace dart | 168 } // namespace dart |
120 | 169 |
121 #endif // VM_OS_THREAD_WIN_H_ | 170 #endif // VM_OS_THREAD_WIN_H_ |
OLD | NEW |