Create a set of threads that repeatedly execute a test function with per-thread initialize and cleanup hooks.
Declared in <bslmt_throughputbenchmark.h>
int
addThreadGroup(
RunFunction const& runFunction,
int numThreads,
bsls::Types::Int64 busyWorkAmount,
InitializeThreadFunction const& initializeFunctor,
CleanupThreadFunction const& cleanupFunctor);
Create a set of threads, with cardinality the specified numThreads, that will repeatedly execute the specified runFunction followed by the specified busyWork, with the specified busyWorkAmount as its argument. Return the index for the thread group. Specify initializeFunctor, which is run at the beginning of each thread of the sample. Specify cleanupFunctor, which is run at the end of each thread of the sample. The behavior is undefined unless 0 < numThreads and 0 <= busyWorkAmount.
index of the created thread group
| Name | Description |
|---|---|
| runFunction | function each thread repeatedly executes |
| numThreads | number of threads in the group |
| busyWorkAmount | work amount passed to busyWork between calls |
| initializeFunctor | functor run at the start of each thread |
| cleanupFunctor | functor run at the end of each thread |