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

Unified Diff: runtime/platform/thread_win.h

Issue 9361036: Implement condition variables on Windows on top of Event/SetEvent/ResetEvent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « no previous file | runtime/platform/thread_win.cc » ('j') | runtime/platform/thread_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/thread_win.h
diff --git a/runtime/platform/thread_win.h b/runtime/platform/thread_win.h
index 35e7261cbb67e5798678abdc6fc823877b3a43fb..02165df2fa7c2c04a0238762d055df97b6a170a9 100644
--- a/runtime/platform/thread_win.h
+++ b/runtime/platform/thread_win.h
@@ -54,11 +54,23 @@ class MonitorData {
~MonitorData() {}
CRITICAL_SECTION cs_;
- // TODO(ager): Condition variables only available since Windows
- // Vista. Therefore, this is only a temporary solution. We will have
- // to implement simple condition variables for use in Windows XP and
- // earlier.
- CONDITION_VARIABLE cond_;
+
+ // Condition variables are only available since Windows Vista. To
+ // support at least Windows XP, we implement our own condition
+ // variables using SetEvent on Event objects.
+
+ // The notify_event_ is an auto-reset event which means that
+ // SetEvent only wakes up one waiter.
+ HANDLE notify_event_;
+
+ // The notify_all_event_ is a manual-reset event which means that
+ // SetEvent wakes up all waiters.
+ HANDLE notify_all_event_;
+
+ // Counter with protection used to determine the right time to reset
+ // the notify_all_event_.
+ CRITICAL_SECTION waiters_cs_;
+ intptr_t waiters_;
friend class Monitor;
« no previous file with comments | « no previous file | runtime/platform/thread_win.cc » ('j') | runtime/platform/thread_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698