| 1 | // |
|---|---|
| 2 | // ThreadPoolTest.h |
| 3 | // |
| 4 | // Definition of the ThreadPoolTest class. |
| 5 | // |
| 6 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 7 | // and Contributors. |
| 8 | // |
| 9 | // SPDX-License-Identifier: BSL-1.0 |
| 10 | // |
| 11 | |
| 12 | |
| 13 | #ifndef ThreadPoolTest_INCLUDED |
| 14 | #define ThreadPoolTest_INCLUDED |
| 15 | |
| 16 | |
| 17 | #include "Poco/Foundation.h" |
| 18 | #include "Poco/CppUnit/TestCase.h" |
| 19 | #include "Poco/Event.h" |
| 20 | #include "Poco/Mutex.h" |
| 21 | |
| 22 | |
| 23 | class ThreadPoolTest: public CppUnit::TestCase |
| 24 | { |
| 25 | public: |
| 26 | ThreadPoolTest(const std::string& name); |
| 27 | ~ThreadPoolTest(); |
| 28 | |
| 29 | void testThreadPool(); |
| 30 | void testThreadPoolUniformDistribution(); |
| 31 | void testThreadPoolCustomDistribution(); |
| 32 | |
| 33 | void setUp(); |
| 34 | void tearDown(); |
| 35 | |
| 36 | static CppUnit::Test* suite(); |
| 37 | |
| 38 | protected: |
| 39 | void count(); |
| 40 | |
| 41 | private: |
| 42 | void startThreadPoolTest(int affinityPolicy); |
| 43 | Poco::FastMutex _mutex; |
| 44 | Poco::Event _event; |
| 45 | int _count; |
| 46 | }; |
| 47 | |
| 48 | |
| 49 | #endif // ThreadPoolTest_INCLUDED |
| 50 |