- 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.
|
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 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
|
|
◆ demonstrateSimpleUsage()
void demonstrateSimpleUsage |
( |
| ) |
|
|
inlineprivate |
◆ 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.
The documentation for this class was generated from the following file: