Index: util/synchronization/semaphore_test.cc |
diff --git a/util/synchronization/semaphore_test.cc b/util/synchronization/semaphore_test.cc |
index 7046373936132d1b012c7742d584beb88b15854a..f359cbddceebf406909fb6d072538afc0fa30ab2 100644 |
--- a/util/synchronization/semaphore_test.cc |
+++ b/util/synchronization/semaphore_test.cc |
@@ -30,6 +30,17 @@ TEST(Semaphore, Simple) { |
semaphore.Signal(); |
} |
+TEST(Semaphore, TimedWait) { |
+ Semaphore semaphore(0); |
+ semaphore.Signal(); |
+ EXPECT_TRUE(semaphore.TimedWait(0.01)); // 10ms |
+} |
+ |
+TEST(Semaphore, TimedWaitTimeout) { |
+ Semaphore semaphore(0); |
+ EXPECT_FALSE(semaphore.TimedWait(0.01)); // 10ms |
+} |
+ |
struct ThreadMainInfo { |
#if defined(OS_POSIX) |
pthread_t pthread; |