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

Unified Diff: runtime/vm/thread_macos.cc

Issue 8362026: Fixed a problem with spurious wakeups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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
Index: runtime/vm/thread_macos.cc
diff --git a/runtime/vm/thread_macos.cc b/runtime/vm/thread_macos.cc
index 93aba9f94eb1430e15959c2ad63cb7faca89906a..1d1fe65f6a5dc44205de002e96ccd4a42905c736 100644
--- a/runtime/vm/thread_macos.cc
+++ b/runtime/vm/thread_macos.cc
@@ -193,6 +193,8 @@ Monitor::WaitResult Monitor::Wait(int64_t millis) {
Monitor::WaitResult retval = kNotified;
if (millis == 0) {
// Wait forever.
+ // If the thread receives a signal, pthread_cond_wait may return 0,
+ // because of a spurious wakeup.
int result = pthread_cond_wait(data_.cond(), data_.mutex());
VALIDATE_PTHREAD_RESULT(result);
} else {
« runtime/vm/thread.h ('K') | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698