Symmetri
Loading...
Searching...
No Matches
symmetri::TaskSystem Class Reference

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>

Public Types

using Task = std::function<void()>
 

Public Member Functions

 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
 
TaskSystemoperator= (TaskSystem const &)=delete
 
TaskSystemoperator= (TaskSystem &&) noexcept=delete
 
void push (Task &&p) const
 push tasks the queue for later execution on the thread pool.
 

Detailed Description

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_countthe 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>

Constructor & Destructor Documentation

◆ TaskSystem()

symmetri::TaskSystem::TaskSystem ( size_t n_threads = std::thread::hardware_concurrency())
explicit

Construct a new Task System object with n threads.

Parameters
n_threadsif less then 1, it defaults to std::thread::hardware_concurrency()

Member Function Documentation

◆ push()

void symmetri::TaskSystem::push ( Task && p) const

push tasks the queue for later execution on the thread pool.

Parameters
p

The documentation for this class was generated from the following files: