Mercurial > hg > orthanc
diff UnitTestsSources/MultiThreadingTests.cpp @ 1681:ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Oct 2015 14:02:39 +0200 |
parents | 15acdb19d520 |
children | b1291df2f780 |
line wrap: on
line diff
--- a/UnitTestsSources/MultiThreadingTests.cpp Tue Oct 06 13:36:09 2015 +0200 +++ b/UnitTestsSources/MultiThreadingTests.cpp Tue Oct 06 14:02:39 2015 +0200 @@ -39,7 +39,6 @@ #include "../Core/MultiThreading/Locker.h" #include "../Core/MultiThreading/Mutex.h" #include "../Core/MultiThreading/ReaderWriterLock.h" -#include "../Core/MultiThreading/RunnableWorkersPool.h" using namespace Orthanc; @@ -258,49 +257,3 @@ t.join(); } } - - -namespace -{ - class MyRunnable : public IRunnableBySteps - { - private: - unsigned int& output_; - unsigned int count_; - - public: - MyRunnable(unsigned int& output) : output_(output), count_(0) - { - } - - virtual bool Step() - { - count_ ++; - output_ ++; - - boost::this_thread::sleep(boost::posix_time::milliseconds(3)); - - return (count_ < 7); - } - }; -} - - -TEST(MultiThreading, RunnableWorkersPool) -{ - unsigned int output = 0; - - { - RunnableWorkersPool pool(3); - - for (size_t i = 0; i < 11; i++) - { - pool.Add(new MyRunnable(output)); - } - - pool.WaitDone(); - } - - - ASSERT_EQ(11 * 7, output); -}