Esempio n. 1
0
void boss(){
    count.wait();
    printf("workers complete their works, now I need to check!\n");
}
Esempio n. 2
0
void worker2(){
    printf("worker 2 begin to work\n");
    sleep(2);
    count.countDown();
    printf("worker 2 complete work\n");
}
void testWaitFuncFalse(CountDownLatch& latch) {
  EXPECT_FALSE(latch.wait(1, std::chrono::seconds(1)));
}
void testWaitFuncTrue(CountDownLatch& latch) {
  EXPECT_TRUE(latch.wait(1, std::chrono::seconds(2)));
}
void testWaitFunc(CountDownLatch& latch) { latch.wait(); }
void testCountDownFunc(CountDownLatch& latch) { latch.countDown(); }