|
asynchrony 0.0.0
Add asynchrony to your C++ applications using standard C++20
|
Implements a single deque based vector of jthreads. All threads wait on the next available item via semaphore and invoke the callback on the next item from the deque. Items in the deque are lock-accessed. More...
#include </opt/azure-agent/_work/14/s/include/siddiqsoft/simple_pool.hpp>
Public Member Functions | |
| simple_pool (simple_pool &&)=delete | |
| simple_pool & | operator= (simple_pool &&)=delete |
| simple_pool (simple_pool &)=delete | |
| simple_pool & | operator= (simple_pool &)=delete |
| ~simple_pool () | |
| Destructor. | |
| simple_pool (std::function< void(T &&)> c) | |
| Contructs a threadpool with N threads with the given callback/worker function. | |
| void | queue (T &&item) |
| Queue item into the deque (takes "ownership" of the item). | |
Static Public Attributes | |
| static constexpr std::chrono::milliseconds | DEFAULT_WAIT_FOR_NEXT_ITEM_MS {1500} |
Implements a single deque based vector of jthreads. All threads wait on the next available item via semaphore and invoke the callback on the next item from the deque. Items in the deque are lock-accessed.
| T | Your datatype #tparam N Number of threads in the pool. Leave it to 0 to use the value returned by std::thread::hardware_concurrency() |
Definition at line 59 of file simple_pool.hpp.
|
inline |
Destructor.
Definition at line 72 of file simple_pool.hpp.
|
inline |
Contructs a threadpool with N threads with the given callback/worker function.
| c | The worker function. |
Definition at line 86 of file simple_pool.hpp.
|
inline |
Queue item into the deque (takes "ownership" of the item).
| item | Item to queue must be move'd |
Definition at line 121 of file simple_pool.hpp.
|
staticconstexpr |
Definition at line 61 of file simple_pool.hpp.