Libthreadar 1.4.0
|
the class ratelier_scatter has a fixed length range of slots of arbitrary defined object type More...
#include <ratelier_scatter.hpp>
Public Member Functions | |
ratelier_scatter (unsigned int size, signed int flag=0) | |
ratelier_scatter (const ratelier_scatter &ref)=delete | |
ratelier_scatter (ratelier_scatter &&ref)=default | |
ratelier_scatter & | operator= (const ratelier_scatter &ref)=delete |
ratelier_scatter & | operator= (ratelier_scatter &&ref) noexcept=default |
void | scatter (std::unique_ptr< T > &one, signed int flag=0) |
std::unique_ptr< T > | worker_get_one (unsigned int &slot, signed int &flag) |
void | reset () |
reset the object in its prestine state More... | |
the class ratelier_scatter has a fixed length range of slots of arbitrary defined object type
the number of slot should be greater than the expected number of worker that will fetch data from. This not mandatory though. worker fetch an object, use it and release it which once the job is completed. While a non-worker thread feeds the ratelier_scatter with new objects. Each object taken from the ratelier by a worker is given an index number for the worker can put this object in a given slot of a ratelier_gather object which will be in charge to deliver the in-sequence result of the different jobs to a gathering thread whatever was the execution order of workers.
Definition at line 63 of file ratelier_scatter.hpp.
libthreadar::ratelier_scatter< T >::ratelier_scatter | ( | unsigned int | size, |
signed int | flag = 0 |
||
) |
Definition at line 119 of file ratelier_scatter.hpp.
void libthreadar::ratelier_scatter< T >::reset |
reset the object in its prestine state
Definition at line 244 of file ratelier_scatter.hpp.
void libthreadar::ratelier_scatter< T >::scatter | ( | std::unique_ptr< T > & | one, |
signed int | flag = 0 |
||
) |
mean for the non-worker thread to provide data to the ratelier_scatter
one | an object to scatter to workers |
flag | is a signal available to worker for any purpose it is associated to the provided object in this call |
Definition at line 130 of file ratelier_scatter.hpp.
References THREADAR_BUG.
std::unique_ptr< T > libthreadar::ratelier_scatter< T >::worker_get_one | ( | unsigned int & | slot, |
signed int & | flag | ||
) |
mean for a worker thread to obtain an object in the lowest slot available
[out] | slot | the slot associated to the object obtained in return of this call |
[out] | flag | a signal associated to this object by from the scattering thread |
Definition at line 173 of file ratelier_scatter.hpp.
References THREADAR_BUG.