Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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

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

Additional Inherited Members

- 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
 
- Public Member Functions inherited from Test
virtual ~Test ()=default
 this is an interface
 
virtual void run (Arg arg)=0
 
void seedRand ()
 draw a new random seed from a common nucleus, and re-seed the default-Gen.
 
lib::Random makeRandGen ()
 build a dedicated new RandomGen, seeded from the default-Gen
 

Member Function Documentation

◆ run()

virtual void run ( Arg  )
inlineprivatevirtual

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

References ThreadWrapper_test::demonstrateSimpleUsage(), Test::seedRand(), and ThreadWrapper_test::verifyConcurrentExecution().

+ Here is the call graph for this function:

◆ demonstrateSimpleUsage()

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

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

Referenced by ThreadWrapper_test::run().

+ Here is the caller graph for this function:

◆ 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.

References lib::test::benchmarkTime(), lib::explore(), and lib::rani().

Referenced by ThreadWrapper_test::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
+ Inheritance diagram for ThreadWrapper_test:
+ Collaboration diagram for ThreadWrapper_test:

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