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