| 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" | 19 #include "vm/profiler.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 #define VALIDATE_PTHREAD_RESULT(result) \ | 23 #define VALIDATE_PTHREAD_RESULT(result) \ |
| 24 if (result != 0) { \ | 24 if (result != 0) { \ |
| 25 const int kBufferSize = 1024; \ | 25 const int kBufferSize = 1024; \ |
| 26 char error_message[kBufferSize]; \ | 26 char error_message[kBufferSize]; \ |
| 27 NOT_IN_PRODUCT(Profiler::DumpStackTrace(true /* native_stack_trace */)); \ | 27 NOT_IN_PRODUCT(Profiler::DumpStackTrace()); \ |
| 28 Utils::StrError(result, error_message, kBufferSize); \ | 28 Utils::StrError(result, error_message, kBufferSize); \ |
| 29 FATAL2("pthread error: %d (%s)", result, error_message); \ | 29 FATAL2("pthread error: %d (%s)", result, error_message); \ |
| 30 } | 30 } |
| 31 | 31 |
| 32 | 32 |
| 33 #if defined(DEBUG) | 33 #if defined(DEBUG) |
| 34 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) | 34 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
| 35 #else | 35 #else |
| 36 // NOTE: This (currently) expands to a no-op. | 36 // NOTE: This (currently) expands to a no-op. |
| 37 #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... |
| 446 void Monitor::NotifyAll() { | 446 void Monitor::NotifyAll() { |
| 447 // When running with assertions enabled we track the owner. | 447 // When running with assertions enabled we track the owner. |
| 448 ASSERT(IsOwnedByCurrentThread()); | 448 ASSERT(IsOwnedByCurrentThread()); |
| 449 int result = pthread_cond_broadcast(data_.cond()); | 449 int result = pthread_cond_broadcast(data_.cond()); |
| 450 VALIDATE_PTHREAD_RESULT(result); | 450 VALIDATE_PTHREAD_RESULT(result); |
| 451 } | 451 } |
| 452 | 452 |
| 453 } // namespace dart | 453 } // namespace dart |
| 454 | 454 |
| 455 #endif // defined(TARGET_OS_ANDROID) | 455 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |