| 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 RUNTIME_VM_OS_THREAD_WIN_H_ | 5 #ifndef RUNTIME_VM_OS_THREAD_WIN_H_ |
| 6 #define RUNTIME_VM_OS_THREAD_WIN_H_ | 6 #define RUNTIME_VM_OS_THREAD_WIN_H_ |
| 7 | 7 |
| 8 #if !defined(RUNTIME_VM_OS_THREAD_H_) | 8 #if !defined(RUNTIME_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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 friend class Monitor; | 116 friend class Monitor; |
| 117 friend class OS; | 117 friend class OS; |
| 118 friend unsigned int __stdcall ThreadEntry(void* data_ptr); | 118 friend unsigned int __stdcall ThreadEntry(void* data_ptr); |
| 119 | 119 |
| 120 DISALLOW_ALLOCATION(); | 120 DISALLOW_ALLOCATION(); |
| 121 DISALLOW_COPY_AND_ASSIGN(MonitorData); | 121 DISALLOW_COPY_AND_ASSIGN(MonitorData); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 | 124 |
| 125 typedef void (*ThreadDestructor) (void* parameter); | 125 typedef void (*ThreadDestructor)(void* parameter); |
| 126 | 126 |
| 127 | 127 |
| 128 class ThreadLocalEntry { | 128 class ThreadLocalEntry { |
| 129 public: | 129 public: |
| 130 ThreadLocalEntry(ThreadLocalKey key, ThreadDestructor destructor) | 130 ThreadLocalEntry(ThreadLocalKey key, ThreadDestructor destructor) |
| 131 : key_(key), | 131 : key_(key), destructor_(destructor) {} |
| 132 destructor_(destructor) { | |
| 133 } | |
| 134 | 132 |
| 135 ThreadLocalKey key() const { | 133 ThreadLocalKey key() const { return key_; } |
| 136 return key_; | |
| 137 } | |
| 138 | 134 |
| 139 | 135 |
| 140 ThreadDestructor destructor() const { | 136 ThreadDestructor destructor() const { return destructor_; } |
| 141 return destructor_; | |
| 142 } | |
| 143 | 137 |
| 144 private: | 138 private: |
| 145 ThreadLocalKey key_; | 139 ThreadLocalKey key_; |
| 146 ThreadDestructor destructor_; | 140 ThreadDestructor destructor_; |
| 147 | 141 |
| 148 DISALLOW_ALLOCATION(); | 142 DISALLOW_ALLOCATION(); |
| 149 }; | 143 }; |
| 150 | 144 |
| 151 | 145 |
| 152 template<typename T> | 146 template <typename T> |
| 153 class MallocGrowableArray; | 147 class MallocGrowableArray; |
| 154 | 148 |
| 155 | 149 |
| 156 class ThreadLocalData : public AllStatic { | 150 class ThreadLocalData : public AllStatic { |
| 157 public: | 151 public: |
| 158 static void RunDestructors(); | 152 static void RunDestructors(); |
| 159 | 153 |
| 160 private: | 154 private: |
| 161 static void AddThreadLocal(ThreadLocalKey key, ThreadDestructor destructor); | 155 static void AddThreadLocal(ThreadLocalKey key, ThreadDestructor destructor); |
| 162 static void RemoveThreadLocal(ThreadLocalKey key); | 156 static void RemoveThreadLocal(ThreadLocalKey key); |
| 163 | 157 |
| 164 static Mutex* mutex_; | 158 static Mutex* mutex_; |
| 165 static MallocGrowableArray<ThreadLocalEntry>* thread_locals_; | 159 static MallocGrowableArray<ThreadLocalEntry>* thread_locals_; |
| 166 | 160 |
| 167 static void InitOnce(); | 161 static void InitOnce(); |
| 168 static void Shutdown(); | 162 static void Shutdown(); |
| 169 | 163 |
| 170 friend class OS; | 164 friend class OS; |
| 171 friend class OSThread; | 165 friend class OSThread; |
| 172 }; | 166 }; |
| 173 | 167 |
| 174 } // namespace dart | 168 } // namespace dart |
| 175 | 169 |
| 176 #endif // RUNTIME_VM_OS_THREAD_WIN_H_ | 170 #endif // RUNTIME_VM_OS_THREAD_WIN_H_ |
| OLD | NEW |