Software Open Access
BS_thread_pool.hpp
:paused
of BS::thread_pool
has 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 pause()
, unpause()
, and is_paused()
member functions. In other words:pool.paused = true
with pool.pause()
.pool.paused = false
with pool.unpause()
.if (pool.paused)
(or similar) with if (pool.is_paused())
.f
of BS::multi_future
has been renamed to futures
for clarity, and has been made private for encapsulation and simplification purposes. Instead of operating on the vector futures
itself, you can now use the []
operator of the BS::multi_future
to 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::endl
and std::flush
, added in v3.2.0 to enable flushing a BS::synced_stream
, caused ODR (One Definition Rule) violations if BS_thread_pool.hpp
was 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_stream
instead of global variables, which also makes the code better organized in my opinion. These objects can now be accessed as BS::synced_stream::endl
and BS::synced_stream::flush
. I also added an example for how to use them in README.md
. See #64.BS_thread_pool_light.hpp
: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_light
class, which is a minimal thread pool with only the 5 most basic member functions:get_thread_count()
push_loop()
push_task()
submit()
wait_for_tasks()
BS_thread_pool_light_test.cpp
tests only the features of the lightweight BS::thread_pool_light
class. 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.Name | Size | |
---|---|---|
bshoshany/thread-pool-v3.3.0.zip
md5:de781fc0b935d9cd4983718a307ff4a6 |
60.2 kB | Download |
All versions | This version | |
---|---|---|
Views | 735 | 159 |
Downloads | 23 | 2 |
Data volume | 621.5 kB | 120.4 kB |
Unique views | 677 | 151 |
Unique downloads | 13 | 2 |