Create a TaskSystem object. The only way to create a TaskSystem is through this factory. We enforce the use of a smart pointer to make sure the pool stays alive until both the original scope of the pool and net is exited.
More...
#include <tasks.h>
|
using | Task = std::function<void()> |
|
|
| TaskSystem (size_t n_threads=std::thread::hardware_concurrency()) |
| Construct a new Task System object with n threads.
|
|
| TaskSystem (TaskSystem const &)=delete |
|
| TaskSystem (TaskSystem &&) noexcept=delete |
|
TaskSystem & | operator= (TaskSystem const &)=delete |
|
TaskSystem & | operator= (TaskSystem &&) noexcept=delete |
|
void | push (Task &&p) const |
| push tasks the queue for later execution on the thread pool.
|
|
Create a TaskSystem object. The only way to create a TaskSystem is through this factory. We enforce the use of a smart pointer to make sure the pool stays alive until both the original scope of the pool and net is exited.
- Parameters
-
thread_count | the amount of threads in the pool. The simplest way to avoid deadlocks in the net is to make sure thread_count is at least the maximum amount of transitions in the net. are ran in parallel. |
- Returns
- std::shared_ptr<const TaskSystem>
◆ TaskSystem()
symmetri::TaskSystem::TaskSystem |
( |
size_t | n_threads = std::thread::hardware_concurrency() | ) |
|
|
explicit |
Construct a new Task System object with n threads.
- Parameters
-
n_threads | if less then 1, it defaults to std::thread::hardware_concurrency() |
◆ push()
void symmetri::TaskSystem::push |
( |
Task && | p | ) |
const |
push tasks the queue for later execution on the thread pool.
- Parameters
-
The documentation for this class was generated from the following files:
- symmetri/include/symmetri/tasks.h
- symmetri/tasks.cpp