Software Open Access
BS::thread_poolhas been made private for future-proofing (in case future versions implement a more involved pausing mechanism) and better encapsulation. It is now accessible only via the
is_paused()member functions. In other words:
pool.paused = truewith
pool.paused = falsewith
if (pool.paused)(or similar) with
BS::multi_futurehas been renamed to
futuresfor clarity, and has been made private for encapsulation and simplification purposes. Instead of operating on the vector
futuresitself, you can now use the
operator of the
BS::multi_futureto access the future at a specific index directly, or the
push_back()member function to append a new future to the list. The
size()member function tells you how many futures are currently stored in the object.
std::flush, added in v3.2.0 to enable flushing a
BS::synced_stream, caused ODR (One Definition Rule) violations if
BS_thread_pool.hppwas included in two different translation units, since they were mistakenly not defined as
inline. To fix this, I decided to make them static members of
BS::synced_streaminstead of global variables, which also makes the code better organized in my opinion. These objects can now be accessed as
BS::synced_stream::flush. I also added an example for how to use them in
README.md. See #64.
BS_thread_pool_light.hpp, with only 170 lines of code (half the size of the full package). This file does not contain any of the helper classes, only a new
BS::thread_pool_lightclass, which is a minimal thread pool with only the 5 most basic member functions:
BS_thread_pool_light_test.cpptests only the features of the lightweight
BS::thread_pool_lightclass. In the spirit of minimalism, it does not generate a log file and does not do any benchmarks.
BS_thread_pool.hpp, and if you wish to use the light version, you only need
BS_thread_pool_light.hpp. Only a single header file needs to be included in your project.