118 CHECK (isnil (queue));
121 queue.
feed ([&]() { val = -1; });
122 CHECK (1 == queue.
size());
127 CHECK (0 == queue.
size());
130 CHECK (0 == queue.
size());
165 uint expected = (5+1)*5/2;
166 CHECK (calc_sum = expected);
167 CHECK (ctor_sum = expected);
168 CHECK (dtor_sum = expected);
197 for (
uint i=0; i<cnt; ++i)
206 , trigger_{commonTrigger}
228 Workers workers{NUM_OF_THREADS,
231 storage.create<
Worker> (queue, trigger);
240 for (
auto& worker : workers)
241 allFine &= worker.
join().isValid();
245 uint64_t globalProducerSum = 0;
246 uint64_t globalConsumerSum = 0;
247 for (
auto& worker : workers)
249 globalProducerSum += worker.producerSum;
250 globalConsumerSum += worker.consumerSum;
254 CHECK (globalProducerSum == globalConsumerSum);
static snd_pcm_sframes_t delay
A Queue for function invocations, allowing them to be dispatched on demand.
A threadsafe queue for bound void(void) functors.
CallQueue & feed(Operation &&op)
int i(uint bound=_iBOUND())
drop-in replacement for rand() % bound
Storage Frame to hold one Child object.
A fixed collection of non-copyable polymorphic objects.
A one time N-fold mutual synchronisation barrier.
scoped guard to control the actual locking.
Facility for monitor object based locking.
Variant of the standard case, requiring to wait and join() on the termination of this thread.
lib::Result< RES > join()
put the caller into a blocking wait until this thread has terminated
void verify_Consistency()
void verify_ThreadSafety()
A Dummy object for tests.
uint const MAX_RAND_INCMT
uint const MAX_RAND_STEPS
uint const NUM_OF_THREADS
uint const MAX_RAND_DELAY
void increment(Dummy< i > &&dummy)
Implementation namespace for support and library code.
Random defaultGen
a global default RandomSequencer for mundane purposes
Test runner and basic definitions for tests.
bool isnil(lib::time::Duration const &dur)
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Managing a collection of non-copyable polymorphic objects in compact storage.
void countConsumerCall(uint increment)
Worker(CallQueue &queue, SyncBarrier &commonTrigger)
A N-fold synchronisation latch using yield-wait until fulfilment.
Object Monitor based synchronisation.
Convenience front-end to simplify and codify basic thread handling.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...