#include <common.h>
Inheritance diagram for rpa::range_step< It, Mutex >:
Public Types | |
typedef guard< Mutex > | guard_t |
typedef range_step_aux< It > | rsa_base |
typedef rsa_base::slice | slice |
Public Member Functions | |
range_step (It aBeg, It aEnd, size_t aStep, Mutex &aMtx, chunk_t aMinChkSz=chunk_t()) | |
slice | chop (void) |
The huge difference with the base 'chop' is the lock. | |
size_t | chop_again (slice &refSlice) |
slice | chop_init_lock_cond (bool mustLock) |
template<class Rng2> | |
tuple2< slice, typename Rng2::slice > | chop_init_lock_cond (Rng2 &aSq2, bool mustLock) |
template<class Rng2> | |
size_t | chop_again (tuple2< slice, typename Rng2::slice > &aPairRef, Rng2 &aSq2) |
Private Member Functions | |
range_step () | |
range_step & | operator= (const range_step &) |
Private Attributes | |
Mutex * | _ptrMtx |
typedef guard< Mutex > rpa::range_step< It, Mutex >::guard_t |
Used to block others sub-threads, when a new 'slice', i.e. a processing unit, is chopped from the input range, by a sub-thread which just started.
typedef range_step_aux< It > rpa::range_step< It, Mutex >::rsa_base |
typedef rsa_base::slice rpa::range_step< It, Mutex >::slice |
Reimplemented from rpa::range_step_aux< It >.
rpa::range_step< It, Mutex >::range_step | ( | ) | [private] |
rpa::range_step< It, Mutex >::range_step | ( | It | aBeg, | |
It | aEnd, | |||
size_t | aStep, | |||
Mutex & | aMtx, | |||
chunk_t | aMinChkSz = chunk_t() | |||
) | [inline] |
This takes as input args, the begin and the end of an input range, a mutex for protecting the critical sections, and a minimal interval size, below which it is better to run in single-threaded mode.
slice rpa::range_step< It, Mutex >::chop | ( | void | ) | [inline] |
size_t rpa::range_step< It, Mutex >::chop_again | ( | tuple2< slice, typename Rng2::slice > & | aPairRef, | |
Rng2 & | aSq2 | |||
) | [inline] |
Flushes the output buffer, then gets a new iterator pair. The range_step mutex is used to protect the flush, AND to 'chop' a new pair of slices.
Protects the slice assignation AND the chop.
Assigns instead of returning the new pair, because we want to benefit from the mutex.
size_t rpa::range_step< It, Mutex >::chop_again | ( | slice & | refSlice | ) | [inline] |
It is cheaper to reuse the same slice, and avoiding the ctor/dtor is useful because they may make other complicated things which are good to avoid.
Protects the slice assignation AND the chop.
Assigns instead of returning the new slice, because we want to benefit from the mutex protection. The possibly derived part of the slice stays untouched.
tuple2< slice, typename Rng2::slice > rpa::range_step< It, Mutex >::chop_init_lock_cond | ( | Rng2 & | aSq2, | |
bool | mustLock | |||
) | [inline] |
When looping on the sub-threads creation, it is unnecessary to lock the input sequence at first call, because no other thread is running.
slice rpa::range_step< It, Mutex >::chop_init_lock_cond | ( | bool | mustLock | ) | [inline] |
When looping on the sub-threads creation, it is unnecessary to lock the input sequence at first call, because no other thread is running.
range_step& rpa::range_step< It, Mutex >::operator= | ( | const range_step< It, Mutex > & | ) | [private] |
Mutex* rpa::range_step< It, Mutex >::_ptrMtx [private] |