Software Open Access
BS_thread_pool.hpp
:wait_for_tasks()
would sometimes get stuck if push_task()
was executed immediately before wait_for_tasks()
.reset()
member function now determine the number of threads to use in the pool as follows. If the parameter is a positive number, then the pool will be created with this number of threads. If the parameter is non-positive, or a parameter was not supplied, then the pool will be created with the total number of hardware threads available, as obtained from std::thread::hardware_concurrency()
. If the latter returns a non-positive number for some reason, then the pool will be created with just one thread. See #51 and #52.[[nodiscard]]
attribute to classes and class members, in order to warn the user when accidentally discarding an important return value, such as a future or the return value of a function with no useful side-effects. For example, if you use submit()
and don't save the future it returns, the compiler will now generate a warning. (If a future is not needed, then you should use push_task()
instead.)explicit
specifier from all constructors, as it prevented the default constructor from being used with static class members. See #48.BS_thread_pool_test.cpp
:count_unique_threads()
using condition variables, to ensure that each thread in the pool runs at least one task regardless of how fast it takes to run the tasks.check()
now explicitly reports what the obtained result was and what it was expected to be.check_task_monitoring()
and check_pausing()
now explicitly report the results of the monitoring at each step.std::vector<std::atomic<bool>>
to std::unique_ptr<std::atomic<bool>[]>
. See #44.README.md
:Name | Size | |
---|---|---|
bshoshany/thread-pool-v3.1.0.zip
md5:3fb8d255b0d598356ac44fb776721684 |
42.3 kB | Download |
All versions | This version | |
---|---|---|
Views | 742 | 15 |
Downloads | 23 | 0 |
Data volume | 621.5 kB | 0 Bytes |
Unique views | 684 | 14 |
Unique downloads | 13 | 0 |