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 PLATFORM_THREAD_WIN_H_ | 5 #ifndef PLATFORM_THREAD_WIN_H_ |
6 #define PLATFORM_THREAD_WIN_H_ | 6 #define PLATFORM_THREAD_WIN_H_ |
7 | 7 |
8 #if !defined(PLATFORM_THREAD_H_) | 8 #if !defined(PLATFORM_THREAD_H_) |
9 #error Do not include thread_win.h directly; use thread.h instead. | 9 #error Do not include thread_win.h directly; use thread.h instead. |
10 #endif | 10 #endif |
11 | 11 |
12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
| 16 typedef DWORD ThreadLocalKey; |
| 17 |
| 18 class ThreadInlineImpl { |
| 19 private: |
| 20 ThreadInlineImpl() {} |
| 21 ~ThreadInlineImpl() {} |
| 22 |
| 23 static uword GetThreadLocal(ThreadLocalKey key) { |
| 24 static ThreadLocalKey kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES; |
| 25 ASSERT(key != kUnsetThreadLocalKey); |
| 26 return reinterpret_cast<uword>(TlsGetValue(key)); |
| 27 } |
| 28 |
| 29 friend class Thread; |
| 30 |
| 31 DISALLOW_ALLOCATION(); |
| 32 DISALLOW_COPY_AND_ASSIGN(ThreadInlineImpl); |
| 33 }; |
| 34 |
| 35 |
16 class MutexData { | 36 class MutexData { |
17 private: | 37 private: |
18 MutexData() {} | 38 MutexData() {} |
19 ~MutexData() {} | 39 ~MutexData() {} |
20 | 40 |
21 HANDLE semaphore_; | 41 HANDLE semaphore_; |
22 | 42 |
23 friend class Mutex; | 43 friend class Mutex; |
24 | 44 |
25 DISALLOW_ALLOCATION(); | 45 DISALLOW_ALLOCATION(); |
(...skipping 15 matching lines...) Expand all Loading... |
41 | 61 |
42 friend class Monitor; | 62 friend class Monitor; |
43 | 63 |
44 DISALLOW_ALLOCATION(); | 64 DISALLOW_ALLOCATION(); |
45 DISALLOW_COPY_AND_ASSIGN(MonitorData); | 65 DISALLOW_COPY_AND_ASSIGN(MonitorData); |
46 }; | 66 }; |
47 | 67 |
48 } // namespace dart | 68 } // namespace dart |
49 | 69 |
50 #endif // PLATFORM_THREAD_WIN_H_ | 70 #endif // PLATFORM_THREAD_WIN_H_ |
OLD | NEW |