Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: runtime/vm/os_thread_macos.cc

Issue 2517473002: Fix tsan failure (Closed)
Patch Set: Address code review comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/os_thread_linux.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread_linux.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698