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

Unified Diff: runtime/vm/os_thread_macos.cc

Issue 1233563004: Avoid race in isolate shutdown; add assertions, error messages (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Move wait per suggestion; port to all platforms. Created 5 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/os_thread_linux.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread_macos.cc
diff --git a/runtime/vm/os_thread_macos.cc b/runtime/vm/os_thread_macos.cc
index 2b870db479d3852a36d82897db5bd6e8f6c93edc..6a9aca22cd58317ef9b058668dc4fc72f2d8b9d9 100644
--- a/runtime/vm/os_thread_macos.cc
+++ b/runtime/vm/os_thread_macos.cc
@@ -31,6 +31,14 @@ namespace dart {
}
+#if defined(DEBUG)
+#define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result)
+#else
+// NOTE: This (currently) expands to a no-op.
+#define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0)
+#endif
+
+
#ifdef DEBUG
#define RETURN_ON_PTHREAD_FAILURE(result) \
if (result != 0) { \
@@ -223,7 +231,7 @@ void Mutex::Lock() {
int result = pthread_mutex_lock(data_.mutex());
// Specifically check for dead lock to help debugging.
ASSERT(result != EDEADLK);
- ASSERT(result == 0); // Verify no other errors.
+ ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors.
// When running with assertions enabled we do track the owner.
#if defined(DEBUG)
owner_ = OSThread::GetCurrentThreadId();
@@ -237,7 +245,7 @@ bool Mutex::TryLock() {
if ((result == EBUSY) || (result == EDEADLK)) {
return false;
}
- ASSERT(result == 0); // Verify no other errors.
+ ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors.
// When running with assertions enabled we do track the owner.
#if defined(DEBUG)
owner_ = OSThread::GetCurrentThreadId();
@@ -255,7 +263,7 @@ void Mutex::Unlock() {
int result = pthread_mutex_unlock(data_.mutex());
// Specifically check for wrong thread unlocking to aid debugging.
ASSERT(result != EPERM);
- ASSERT(result == 0); // Verify no other errors.
+ ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors.
}
« no previous file with comments | « runtime/vm/os_thread_linux.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698