Lumiera  0.pre.03
»edit your freedom«
ThreadWrapper_test Class Reference

Description

Test:
use the lib::Thread wrapper for simplified definition of the thread-function, argument binding and starting of threads.
See also
thread.hpp
ThreadWrapperJoin_test
SyncLocking_test

Definition at line 53 of file thread-wrapper-test.cpp.

Private Member Functions

void demonstrateSimpleUsage ()
 
virtual void run (Arg)
 
void verifyConcurrentExecution ()
 

Additional Inherited Members

- Public Member Functions inherited from Test
virtual ~Test ()=default
 this is an interface
 
lib::Random makeRandGen ()
 build a dedicated new RandomGen, seeded from the default-Gen
 
virtual void run (Arg arg)=0
 
void seedRand ()
 draw a new random seed from a common nucleus, and re-seed the default-Gen.
 
- Static Public Member Functions inherited from Test
static string firstTok (Arg)
 conveniently pick the first token from the argument line
 
static uint firstVal (Arg, uint=1)
 conveniently use some number given as argument, with optional default
 

Member Function Documentation

◆ demonstrateSimpleUsage()

void demonstrateSimpleUsage ( )
inlineprivate
Test:
demonstrate simple usage of the thread-wrapper a λ-binding

Definition at line 67 of file thread-wrapper-test.cpp.

◆ verifyConcurrentExecution()

void verifyConcurrentExecution ( )
inlineprivate
Test:
verify the thread function is actually performed concurrently
  • use a derived Thread object, also holding a local data field
  • the thread function sleeps, and then stores the sum of two numbers
  • demonstrate that each instance can have a different argument binding
  • verify each thread function has actually been invoked once per thread, by comparing a local sum with values collected from the Thread objects,
  • moreover measure the overall time required for launching the threads and then waiting for all threads to have terminated and detached; this time must be shorter than all the average sleep times compounded (as if the function was invoked sequentially).

< the actual operation running in a separate thread

Definition at line 90 of file thread-wrapper-test.cpp.

+ Inheritance diagram for ThreadWrapper_test:
+ Collaboration diagram for ThreadWrapper_test:

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