diff options
Diffstat (limited to 'cpp/test/IceUtil/thread/CountDownLatchTest.cpp')
-rw-r--r-- | cpp/test/IceUtil/thread/CountDownLatchTest.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cpp/test/IceUtil/thread/CountDownLatchTest.cpp b/cpp/test/IceUtil/thread/CountDownLatchTest.cpp index 32af5700bba..1e4c752c6ad 100644 --- a/cpp/test/IceUtil/thread/CountDownLatchTest.cpp +++ b/cpp/test/IceUtil/thread/CountDownLatchTest.cpp @@ -24,7 +24,7 @@ static const int magic = 0xbeef; class CountDownLatchTestThread : public Thread { public: - + CountDownLatchTestThread(CountDownLatch& latch, int& val, bool takeOne) : _latch(latch), _val(val), @@ -33,18 +33,18 @@ public: } virtual void run() - { + { if(_takeOne) { _latch.countDown(); } - + if(_latch.getCount() == 0) { test(_val == magic); } - + _latch.await(); test(_latch.getCount() == 0); test(_val == magic); @@ -53,7 +53,7 @@ public: private: CountDownLatch& _latch; - int& _val; + int& _val; bool _takeOne; }; @@ -81,7 +81,7 @@ CountDownLatchTest::run() t1[i] = new CountDownLatchTestThread(latch, val, false); t1[i]->start(); } - + // // Sleep a little bit, and check count // @@ -97,33 +97,33 @@ CountDownLatchTest::run() t2[i] = new CountDownLatchTestThread(latch, val, true); t2[i]->start(); } - + // // Sleep until count == 1 // do { ThreadControl::sleep(Time::milliSeconds(100)); - + for(i = 0; i < wave1Count; i++) { test(t1[i]->isAlive()); } - + for(i = 0; i < fullCount - 1; i++) { test(t2[i]->isAlive()); } } while(latch.getCount() > 1); - + // // Set val and release last count // val = magic; latch.countDown(); test(latch.getCount() == 0); - + // // Join them all // @@ -136,9 +136,9 @@ CountDownLatchTest::run() { t2[i]->getThreadControl().join(); } - + test(latch.getCount() == 0); - + const int wave2Count = 4; ThreadPtr t3[wave2Count]; for(i = 0; i < wave2Count; i++) @@ -147,7 +147,7 @@ CountDownLatchTest::run() t3[i]->start(); } test(latch.getCount() == 0); - + for(i = 0; i < wave2Count; i++) { t3[i]->getThreadControl().join(); |