OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
7 | 7 |
8 #include "vm/os_thread.h" | 8 #include "vm/os_thread.h" |
9 #include "vm/os_thread_fuchsia.h" | 9 #include "vm/os_thread_fuchsia.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) | 26 #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
27 #else | 27 #else |
28 // NOTE: This (currently) expands to a no-op. | 28 // NOTE: This (currently) expands to a no-op. |
29 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) | 29 #define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) |
30 #endif | 30 #endif |
31 | 31 |
32 | 32 |
33 #ifdef DEBUG | 33 #ifdef DEBUG |
34 #define RETURN_ON_PTHREAD_FAILURE(result) \ | 34 #define RETURN_ON_PTHREAD_FAILURE(result) \ |
35 if (result != 0) { \ | 35 if (result != 0) { \ |
36 const int kBufferSize = 1024; \ | |
37 char error_buf[kBufferSize]; \ | |
38 fprintf(stderr, "%s:%d: pthread error: %d\n", \ | 36 fprintf(stderr, "%s:%d: pthread error: %d\n", \ |
39 __FILE__, __LINE__, result); \ | 37 __FILE__, __LINE__, result); \ |
40 return result; \ | 38 return result; \ |
41 } | 39 } |
42 #else | 40 #else |
43 #define RETURN_ON_PTHREAD_FAILURE(result) \ | 41 #define RETURN_ON_PTHREAD_FAILURE(result) \ |
44 if (result != 0) return result; | 42 if (result != 0) return result; |
45 #endif | 43 #endif |
46 | 44 |
47 | 45 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 void Monitor::NotifyAll() { | 420 void Monitor::NotifyAll() { |
423 // When running with assertions enabled we track the owner. | 421 // When running with assertions enabled we track the owner. |
424 ASSERT(IsOwnedByCurrentThread()); | 422 ASSERT(IsOwnedByCurrentThread()); |
425 int result = pthread_cond_broadcast(data_.cond()); | 423 int result = pthread_cond_broadcast(data_.cond()); |
426 VALIDATE_PTHREAD_RESULT(result); | 424 VALIDATE_PTHREAD_RESULT(result); |
427 } | 425 } |
428 | 426 |
429 } // namespace dart | 427 } // namespace dart |
430 | 428 |
431 #endif // defined(TARGET_OS_FUCHSIA) | 429 #endif // defined(TARGET_OS_FUCHSIA) |
OLD | NEW |