| 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_H_ | 5 #ifndef VM_OS_THREAD_H_ |
| 6 #define VM_OS_THREAD_H_ | 6 #define VM_OS_THREAD_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void Exit(); | 106 void Exit(); |
| 107 | 107 |
| 108 // Wait for notification or timeout. | 108 // Wait for notification or timeout. |
| 109 WaitResult Wait(int64_t millis); | 109 WaitResult Wait(int64_t millis); |
| 110 WaitResult WaitMicros(int64_t micros); | 110 WaitResult WaitMicros(int64_t micros); |
| 111 | 111 |
| 112 // Notify waiting threads. | 112 // Notify waiting threads. |
| 113 void Notify(); | 113 void Notify(); |
| 114 void NotifyAll(); | 114 void NotifyAll(); |
| 115 | 115 |
| 116 #if defined(DEBUG) |
| 117 bool IsOwnedByCurrentThread() const { |
| 118 return owner_ == OSThread::GetCurrentThreadId(); |
| 119 } |
| 120 #else |
| 121 bool IsOwnedByCurrentThread() const { |
| 122 UNREACHABLE(); |
| 123 return false; |
| 124 } |
| 125 #endif |
| 126 |
| 116 private: | 127 private: |
| 117 MonitorData data_; // OS-specific data. | 128 MonitorData data_; // OS-specific data. |
| 129 #if defined(DEBUG) |
| 130 ThreadId owner_; |
| 131 #endif // defined(DEBUG) |
| 118 | 132 |
| 119 DISALLOW_COPY_AND_ASSIGN(Monitor); | 133 DISALLOW_COPY_AND_ASSIGN(Monitor); |
| 120 }; | 134 }; |
| 121 | 135 |
| 122 | 136 |
| 123 } // namespace dart | 137 } // namespace dart |
| 124 | 138 |
| 125 | 139 |
| 126 #endif // VM_OS_THREAD_H_ | 140 #endif // VM_OS_THREAD_H_ |
| OLD | NEW |