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

Unified Diff: runtime/vm/message_queue_test.cc

Issue 8347013: Fix more races in MessageQueue_WaitNotify. My notifies could show up (Closed) Base URL: http://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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_queue_test.cc
===================================================================
--- runtime/vm/message_queue_test.cc (revision 534)
+++ runtime/vm/message_queue_test.cc (working copy)
@@ -63,18 +63,19 @@
// Create a message queue and share it.
MessageQueue* queue = new MessageQueue();
+ MessageQueueTestPeer peer(queue);
shared_queue = queue;
- // Tell the other thread to fill the queue a bit.
+ // Tell the other thread that the shared queue is ready.
{
MonitorLocker ml(sync);
ml.Notify();
}
siva 2011/10/18 22:19:59 The update to shared_queue could be under a lock:
// Wait for the other thread to fill the queue a bit.
- {
+ while (!peer.HasMessage()) {
MonitorLocker ml(sync);
- ml.Wait(0);
+ ml.Wait(5);
}
siva 2011/10/18 22:19:59 The check for peer.HasMessage() could be under a l
for (int i = 0; i < 3; i++) {
@@ -106,9 +107,9 @@
EXPECT(thread != NULL);
// Wait for the shared queue to be created.
- {
+ while (shared_queue == NULL) {
MonitorLocker ml(sync);
- ml.Wait(0);
+ ml.Wait(5);
}
siva 2011/10/18 22:19:59 The check for shared queue could be under a lock:
ASSERT(shared_queue != NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698