Class implementing a warehouse thread pool to deal with pulse tasks.
More...
#include <PulseWarehouseThreadPool.h>
|
| PulseWarehouseThreadPool (std::size_t const _pool_size, double const deviceAccuracy, std::size_t const maxTasks=256) |
| Pulse warehouse thread pool constructor. More...
|
|
void | run_pulse_task (TaskDropper< PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double >> &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & > &dropper) override |
|
bool | try_run_pulse_task (TaskDropper< PulseTask, PulseThreadPoolInterface, std::vector< std::vector< double >> &, RandomnessGenerator< double > &, RandomnessGenerator< double > &, NoiseSource< double > & > &dropper) override |
|
void | join () override |
|
virtual bool | post (shared_ptr< PulseTaskDropper > task) |
| Expose the warehouse post method. More...
|
|
virtual bool | post (vector< shared_ptr< PulseTaskDropper >> &tasks) |
| Expose the warehouse post method. More...
|
|
virtual shared_ptr< PulseTaskDropper > | get () |
| Expose the warehouse get method. More...
|
|
virtual void | notify () |
| Expose the warehouse notify method. More...
|
|
virtual void | notifyAll () |
| Expose the warehouse notify all method. More...
|
|
virtual void | start () |
| Start the warehouse thread pool. More...
|
|
virtual void | finish () |
| Finish the warehouse thread pool in a proper way. It is, allowing all tasks to finish properly and emptying the warehouse. More...
|
|
| ThreadPool (std::size_t const _pool_size) |
| Thread pool constructor. More...
|
|
virtual std::size_t | getPoolSize () const |
| Obtain the thread pool size. More...
|
|
|
void | doTask (size_t const tid, shared_ptr< PulseTaskDropper > task) override |
| Thread execute given task using its associated resources. It is, its apMatrix, its randomness generators and its noise source. More...
|
|
| WarehouseThreadPool (std::size_t const _pool_size, std::size_t const maxTasks=256) |
| Warehouse thread pool constructor. More...
|
|
virtual void | _start (size_t const tid) |
| Start a thread. More...
|
|
virtual void | finalJoin () |
| Lock until all pending tasks have been finished. If it is not called after finish, it will lead to an eternal waiting. More...
|
|
|
std::vector< std::vector< double > > * | apMatrices |
|
RandomnessGenerator< double > * | randGens |
| First randomness generators (general purpose), one per thread.
|
|
RandomnessGenerator< double > * | randGens2 |
| Second randomness generators (to substitute old box muller), one per thread.
|
|
UniformNoiseSource< double > * | intersectionHandlingNoiseSources |
| Intersection handling noise sources, one per thread.
|
|
TaskWarehouse< PulseTaskDropper > | warehouse |
| The task warehouse used to handle tasks.
|
|
bool | working |
| True if thread pool is working, false if it is already finished. More...
|
|
int | workersCount |
| Count how many active workers there are. It is used for final join.
|
|
int | pendingCount |
| Count how many workers with pending tasks there are. It is used for join (not final join). It can also be read as working count (not workers count) because it counts how many working threads there are.
|
|
boost::mutex | mtx |
| Mutex to handle concurrent access to workers count.
|
|
boost::condition_variable | condvar |
| Conditional variable to handle concurrent access to workers count.
|
|
boost::mutex | joinMtx |
| Mutex to handle join until warehouse is empty (not the final join) More...
|
|
boost::condition_variable | joinCondvar |
| Conditional variable to handle join until warehouse is empty (not the final join) More...
|
|
boost::asio::io_service | io_service_ |
| Instance of boost input/output service for asynchronous data processing.
|
|
std::size_t | pool_size |
| Size of thread pool (number of threads)
|
|
boost::asio::io_service | io_service_ |
| Instance of boost input/output service for asynchronous data processing.
|
|
boost::asio::executor_work_guard< boost::asio::io_service::executor_type > | work_ |
| Instance of work guard to report the io service when it has pending tasks. More...
|
|
std::size_t | pool_size |
| Size of thread pool (number of threads)
|
|
boost::thread_group | threads_ |
| Group of threads.
|
|
Class implementing a warehouse thread pool to deal with pulse tasks.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
- See also
- WarehouseThreadPool
◆ PulseWarehouseThreadPool()
PulseWarehouseThreadPool::PulseWarehouseThreadPool |
( |
std::size_t const |
_pool_size, |
|
|
double const |
deviceAccuracy, |
|
|
std::size_t const |
maxTasks = 256 |
|
) |
| |
|
inlineexplicit |
Pulse warehouse thread pool constructor.
- See also
- ThreadPool::pool_size
- Parameters
-
deviceAccuracy | Parameter used to handle randomness generation impact on simulation results |
◆ doTask()
void PulseWarehouseThreadPool::doTask |
( |
size_t const |
tid, |
|
|
shared_ptr< PulseTaskDropper > |
task |
|
) |
| |
|
inlineoverrideprotectedvirtual |
◆ join()
void PulseWarehouseThreadPool::join |
( |
| ) |
|
|
inlineoverridevirtual |
◆ run_pulse_task()
◆ try_run_pulse_task()
◆ apMatrices
std::vector<std::vector<double> >* PulseWarehouseThreadPool::apMatrices |
|
protected |
Alpha prime matrices for MarquardtFitter. One per thread, to avoid spamming reallocations
The documentation for this class was generated from the following file: