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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
9 | 9 |
10 #include <sys/errno.h> // NOLINT | 10 #include <sys/errno.h> // NOLINT |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "platform/utils.h" | 22 #include "platform/utils.h" |
23 | 23 |
24 #include "vm/profiler.h" | 24 #include "vm/profiler.h" |
25 | 25 |
26 namespace dart { | 26 namespace dart { |
27 | 27 |
28 #define VALIDATE_PTHREAD_RESULT(result) \ | 28 #define VALIDATE_PTHREAD_RESULT(result) \ |
29 if (result != 0) { \ | 29 if (result != 0) { \ |
30 const int kBufferSize = 1024; \ | 30 const int kBufferSize = 1024; \ |
31 char error_message[kBufferSize]; \ | 31 char error_message[kBufferSize]; \ |
32 NOT_IN_PRODUCT(Profiler::DumpStackTrace(true /* native_stack_trace */)); \ | 32 NOT_IN_PRODUCT(Profiler::DumpStackTrace()); \ |
33 Utils::StrError(result, error_message, kBufferSize); \ | 33 Utils::StrError(result, error_message, kBufferSize); \ |
34 FATAL2("pthread error: %d (%s)", result, error_message); \ | 34 FATAL2("pthread error: %d (%s)", result, error_message); \ |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 #if defined(DEBUG) | 38 #if defined(DEBUG) |
39 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) | 39 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
40 #else | 40 #else |
41 // NOTE: This (currently) expands to a no-op. | 41 // NOTE: This (currently) expands to a no-op. |
42 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) | 42 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 void Monitor::NotifyAll() { | 423 void Monitor::NotifyAll() { |
424 // When running with assertions enabled we track the owner. | 424 // When running with assertions enabled we track the owner. |
425 ASSERT(IsOwnedByCurrentThread()); | 425 ASSERT(IsOwnedByCurrentThread()); |
426 int result = pthread_cond_broadcast(data_.cond()); | 426 int result = pthread_cond_broadcast(data_.cond()); |
427 VALIDATE_PTHREAD_RESULT(result); | 427 VALIDATE_PTHREAD_RESULT(result); |
428 } | 428 } |
429 | 429 |
430 } // namespace dart | 430 } // namespace dart |
431 | 431 |
432 #endif // defined(TARGET_OS_MACOS) | 432 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |