[#BloombergLP-bslmt-ThroughputBenchmark-addThreadGroup-0e] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslmt.adoc[bslmt]::xref:BloombergLP/bslmt/ThroughputBenchmark.adoc[ThroughputBenchmark]::addThreadGroup :relfileprefix: ../../../ :mrdocs: Create a set of threads that repeatedly execute a test function with per‐thread initialize and cleanup hooks. == Synopsis Declared in `<bslmt_throughputbenchmark.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int addThreadGroup( xref:BloombergLP/bslmt/ThroughputBenchmark/RunFunction.adoc[RunFunction] const& runFunction, int numThreads, xref:BloombergLP/bsls/Types/Int64.adoc[bsls::Types::Int64] busyWorkAmount, xref:BloombergLP/bslmt/ThroughputBenchmark/InitializeThreadFunction.adoc[InitializeThreadFunction] const& initializeFunctor, xref:BloombergLP/bslmt/ThroughputBenchmark/CleanupThreadFunction.adoc[CleanupThreadFunction] const& cleanupFunctor); ---- == Description 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`. == Return Value index of the created thread group == Parameters [cols="1,4"] |=== | 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 |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#