MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / check_reset

Function check_reset

tests/BS_thread_pool_test.cpp:830–843  ·  view source on GitHub ↗

* @brief Check that reset() works. */

Source from the content-addressed store, hash-verified

828 * @brief Check that reset() works.
829 */
830void check_reset()
831{
832 BS::thread_pool pool;
833 pool.reset(static_cast<std::size_t>(std::thread::hardware_concurrency()) * 2);
834 logln("Checking that after reset() the thread pool reports a number of threads equal to double the hardware concurrency...");
835 check(std::thread::hardware_concurrency() * 2, pool.get_thread_count());
836 logln("Checking that after reset() the manually counted number of unique thread IDs is equal to the reported number of threads...");
837 check(pool.get_thread_count(), obtain_unique_threads(pool).size());
838 pool.reset(std::thread::hardware_concurrency());
839 logln("Checking that after a second reset() the thread pool reports a number of threads equal to the hardware concurrency...");
840 check(std::thread::hardware_concurrency(), pool.get_thread_count());
841 logln("Checking that after a second reset() the manually counted number of unique thread IDs is equal to the reported number of threads...");
842 check(pool.get_thread_count(), obtain_unique_threads(pool).size());
843}
844
845// =======================================
846// Functions to verify submission of tasks

Callers 1

mainFunction · 0.85

Calls 3

loglnFunction · 0.85
checkFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected