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 #include "platform/globals.h" // NOLINT | 5 #include "platform/globals.h" // NOLINT |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
9 | 9 |
10 #include <process.h> // NOLINT | 10 #include <process.h> // NOLINT |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return res == WAIT_OBJECT_0; | 111 return res == WAIT_OBJECT_0; |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { | 115 intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
116 ASSERT(sizeof(id) <= sizeof(intptr_t)); | 116 ASSERT(sizeof(id) <= sizeof(intptr_t)); |
117 return static_cast<intptr_t>(id); | 117 return static_cast<intptr_t>(id); |
118 } | 118 } |
119 | 119 |
120 | 120 |
| 121 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { |
| 122 return static_cast<ThreadId>(id); |
| 123 } |
| 124 |
| 125 |
121 bool OSThread::Compare(ThreadId a, ThreadId b) { | 126 bool OSThread::Compare(ThreadId a, ThreadId b) { |
122 return a == b; | 127 return a == b; |
123 } | 128 } |
124 | 129 |
125 | 130 |
126 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { | 131 void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
127 static const int64_t kTimeEpoc = 116444736000000000LL; | 132 static const int64_t kTimeEpoc = 116444736000000000LL; |
128 static const int64_t kTimeScaler = 10; // 100 ns to us. | 133 static const int64_t kTimeScaler = 10; // 100 ns to us. |
129 // Although win32 uses 64-bit integers for representing timestamps, | 134 // Although win32 uses 64-bit integers for representing timestamps, |
130 // these are packed into a FILETIME structure. The FILETIME | 135 // these are packed into a FILETIME structure. The FILETIME |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // timeout before we signal it, that object will get an extra | 456 // timeout before we signal it, that object will get an extra |
452 // signal. This will be treated as a spurious wake-up and is OK | 457 // signal. This will be treated as a spurious wake-up and is OK |
453 // since all uses of monitors should recheck the condition after a | 458 // since all uses of monitors should recheck the condition after a |
454 // Wait. | 459 // Wait. |
455 data_.SignalAndRemoveAllWaiters(); | 460 data_.SignalAndRemoveAllWaiters(); |
456 } | 461 } |
457 | 462 |
458 } // namespace dart | 463 } // namespace dart |
459 | 464 |
460 #endif // defined(TARGET_OS_WINDOWS) | 465 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |