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/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 // Returns the current thread and moves forward. | 240 // Returns the current thread and moves forward. |
241 OSThread* Next(); | 241 OSThread* Next(); |
242 | 242 |
243 private: | 243 private: |
244 OSThread* next_; | 244 OSThread* next_; |
245 }; | 245 }; |
246 | 246 |
247 | 247 |
248 class Mutex { | 248 class Mutex { |
249 public: | 249 public: |
250 Mutex(); | 250 explicit Mutex(bool recursive = false); |
Ivan Posva
2015/12/09 16:34:57
The class Mutex is defined to not ever be recursiv
Florian Schneider
2015/12/10 14:44:21
What would break otherwise? I didn't see any tests
| |
251 ~Mutex(); | 251 ~Mutex(); |
252 | 252 |
253 void Lock(); | 253 void Lock(); |
254 bool TryLock(); | 254 bool TryLock(); |
255 void Unlock(); | 255 void Unlock(); |
256 | 256 |
257 #if defined(DEBUG) | 257 #if defined(DEBUG) |
258 bool IsOwnedByCurrentThread() const { | 258 bool IsOwnedByCurrentThread() const { |
259 return owner_ == OSThread::GetCurrentThreadId(); | 259 return owner_ == OSThread::GetCurrentThreadId(); |
260 } | 260 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 #endif // defined(DEBUG) | 316 #endif // defined(DEBUG) |
317 | 317 |
318 DISALLOW_COPY_AND_ASSIGN(Monitor); | 318 DISALLOW_COPY_AND_ASSIGN(Monitor); |
319 }; | 319 }; |
320 | 320 |
321 | 321 |
322 } // namespace dart | 322 } // namespace dart |
323 | 323 |
324 | 324 |
325 #endif // VM_OS_THREAD_H_ | 325 #endif // VM_OS_THREAD_H_ |
OLD | NEW |