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

Unified Diff: runtime/vm/thread_test.cc

Issue 11361157: Fix bug 6586: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/tests/vm/vm.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_test.cc
===================================================================
--- runtime/vm/thread_test.cc (revision 14653)
+++ runtime/vm/thread_test.cc (working copy)
@@ -39,18 +39,33 @@
monitor->Enter();
monitor->Exit();
- {
+ const int kNumAttempts = 5;
+ int attempts = 0;
+ while (attempts < kNumAttempts) {
MonitorLocker ml(monitor);
int64_t start = OS::GetCurrentTimeMillis();
int64_t wait_time = 2017;
Monitor::WaitResult wait_result = ml.Wait(wait_time);
int64_t stop = OS::GetCurrentTimeMillis();
+
+ // We expect to be timing out here.
EXPECT_EQ(Monitor::kTimedOut, wait_result);
+
+ // Check whether this attempt falls within the exptected time limits.
+ int64_t wakeup_time = stop - start;
+ OS::Print("wakeup_time: %"Pd64"\n", wakeup_time);
const int kAcceptableTimeJitter = 20; // Measured in milliseconds.
- EXPECT_LE(wait_time - kAcceptableTimeJitter, stop - start);
const int kAcceptableWakeupDelay = 150; // Measured in milliseconds.
- EXPECT_GE(wait_time + kAcceptableWakeupDelay, stop - start);
+ if (((wait_time - kAcceptableTimeJitter) <= wakeup_time) &&
+ (wakeup_time <= (wait_time + kAcceptableWakeupDelay))) {
+ break;
+ }
+
+ // Record the attempt.
+ attempts++;
}
+ EXPECT_LT(attempts, kNumAttempts);
+
// The isolate shutdown and the destruction of the mutex are out-of-order on
// purpose.
isolate->Shutdown();
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698