Libthreadar 1.4.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
libthreadar::ratelier_gather< T > Class Template Reference

the class ratelier_gather has a fixed length range of slots of arbitrary defined object type More...

#include <ratelier_gather.hpp>

Public Member Functions

 ratelier_gather (unsigned int size, signed int flag=0)
 
 ratelier_gather (const ratelier_gather &ref)=delete
 
 ratelier_gather (ratelier_gather &&ref)=default
 
ratelier_gatheroperator= (const ratelier_gather &ref)=delete
 
ratelier_gatheroperator= (ratelier_gather &&ref) noexcept=default
 
void worker_push_one (unsigned int slot, std::unique_ptr< T > &one, signed int flag=0)
 provides to a worker thread a mean to given data with its associated index to a gathering thread
 
void gather (std::deque< std::unique_ptr< T > > &ones, std::deque< signed int > &flag)
 obtain the lowest continuous filled slots of the ratelier_gather and free them
 
void reset ()
 reset the object in its prestine state
 

Detailed Description

template<class T>
class libthreadar::ratelier_gather< T >

the class ratelier_gather has a fixed length range of slots of arbitrary defined object type

the number of slot should be greater than the number of workers that fill the ratelier with data workers put objects at a given slot and a non-worker thread (or gathering thread) get those objects in order, this releases the corresponding slots of the ratelier_gather

Definition at line 97 of file ratelier_gather.hpp.

Constructor & Destructor Documentation

◆ ratelier_gather()

template<class T >
libthreadar::ratelier_gather< T >::ratelier_gather ( unsigned int  size,
signed int  flag = 0 
)

Definition at line 152 of file ratelier_gather.hpp.

Member Function Documentation

◆ gather()

template<class T >
void libthreadar::ratelier_gather< T >::gather ( std::deque< std::unique_ptr< T > > &  ones,
std::deque< signed int > &  flag 
)

obtain the lowest continuous filled slots of the ratelier_gather and free them

Parameters
[out]onesis a list of continuously indexed objects which immediately follows the list provided by a previous call to gather() and will be immediately followed by the list returned by a next call to gather().
[out]flagis the purpose free signal give by the worker and associated to each data

Definition at line 212 of file ratelier_gather.hpp.

References THREADAR_BUG.

◆ reset()

template<class T >
void libthreadar::ratelier_gather< T >::reset ( )

reset the object in its prestine state

Definition at line 283 of file ratelier_gather.hpp.

◆ worker_push_one()

template<class T >
void libthreadar::ratelier_gather< T >::worker_push_one ( unsigned int  slot,
std::unique_ptr< T > &  one,
signed int  flag = 0 
)

provides to a worker thread a mean to given data with its associated index to a gathering thread

Parameters
[in]slotis the slot number associated to the provided object "one"
[in]oneis the object to push to the gathering thread
[in]flagis a purpose free signal to send to the gathering thread and associated to this object. the value it had before this call with the value given in argument to the call
Note
if the slot is already full an exception is thrown
if the ratelier_gather is full the caller will be suspended until the non-worker thread calls get() to make some room

Definition at line 162 of file ratelier_gather.hpp.

References THREADAR_BUG.


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