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

Unified Diff: test/cctest/test-lock.cc

Issue 48123: Added a wait with timeout to the platform semaphore class (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « src/platform-win32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-lock.cc
===================================================================
--- test/cctest/test-lock.cc (revision 1525)
+++ test/cctest/test-lock.cc (working copy)
@@ -38,3 +38,26 @@
CHECK_EQ(0, mutex->Unlock());
delete mutex;
}
+
+
+TEST(SemaphoreTimeout) {
+ bool ok;
+ Semaphore* sem = OS::CreateSemaphore(0);
+
+ // Semaphore not signalled - timeout.
+ ok = sem->Wait(0);
+ CHECK(!ok);
+ ok = sem->Wait(100);
+ CHECK(!ok);
+ ok = sem->Wait(1000);
+ CHECK(!ok);
+
+ // Semaphore signalled - no timeout.
+ sem->Signal();
+ ok = sem->Wait(0);
+ sem->Signal();
+ ok = sem->Wait(100);
+ sem->Signal();
+ ok = sem->Wait(1000);
+ CHECK(ok);
+}
« no previous file with comments | « src/platform-win32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698