Index: runtime/vm/os_thread_android.cc |
diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc |
index 443e800e4d542595da9b1fb65f6388f268856006..ae1b9f2d4e81c755dfbd079b9f3c061eb03b6620 100644 |
--- a/runtime/vm/os_thread_android.cc |
+++ b/runtime/vm/os_thread_android.cc |
@@ -23,6 +23,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) { \ |
@@ -217,7 +225,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(); |
@@ -231,7 +239,7 @@ bool Mutex::TryLock() { |
if (result == EBUSY) { |
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(); |
@@ -249,7 +257,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. |
} |