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 | 6 |
7 | 7 |
8 #if defined(TARGET_OS_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
9 | 9 |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
11 | 11 |
12 #include <errno.h> // NOLINT | 12 #include <errno.h> // NOLINT |
13 #include <sys/time.h> // NOLINT | 13 #include <sys/time.h> // NOLINT |
14 | 14 |
15 #include "platform/assert.h" | 15 #include "platform/assert.h" |
16 #include "platform/signal_blocker.h" | 16 #include "platform/signal_blocker.h" |
17 #include "platform/utils.h" | 17 #include "platform/utils.h" |
18 | 18 |
| 19 #include "vm/profiler.h" |
| 20 |
19 namespace dart { | 21 namespace dart { |
20 | 22 |
21 #define VALIDATE_PTHREAD_RESULT(result) \ | 23 #define VALIDATE_PTHREAD_RESULT(result) \ |
22 if (result != 0) { \ | 24 if (result != 0) { \ |
23 const int kBufferSize = 1024; \ | 25 const int kBufferSize = 1024; \ |
24 char error_message[kBufferSize]; \ | 26 char error_message[kBufferSize]; \ |
| 27 NOT_IN_PRODUCT(Profiler::DumpStackTrace(true /* native_stack_trace */)); \ |
25 Utils::StrError(result, error_message, kBufferSize); \ | 28 Utils::StrError(result, error_message, kBufferSize); \ |
26 FATAL2("pthread error: %d (%s)", result, error_message); \ | 29 FATAL2("pthread error: %d (%s)", result, error_message); \ |
27 } | 30 } |
28 | 31 |
29 | 32 |
30 #if defined(DEBUG) | 33 #if defined(DEBUG) |
31 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) | 34 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
32 #else | 35 #else |
33 // NOTE: This (currently) expands to a no-op. | 36 // NOTE: This (currently) expands to a no-op. |
34 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) | 37 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 void Monitor::NotifyAll() { | 446 void Monitor::NotifyAll() { |
444 // When running with assertions enabled we track the owner. | 447 // When running with assertions enabled we track the owner. |
445 ASSERT(IsOwnedByCurrentThread()); | 448 ASSERT(IsOwnedByCurrentThread()); |
446 int result = pthread_cond_broadcast(data_.cond()); | 449 int result = pthread_cond_broadcast(data_.cond()); |
447 VALIDATE_PTHREAD_RESULT(result); | 450 VALIDATE_PTHREAD_RESULT(result); |
448 } | 451 } |
449 | 452 |
450 } // namespace dart | 453 } // namespace dart |
451 | 454 |
452 #endif // defined(TARGET_OS_ANDROID) | 455 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |