$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$

Syntax
ok = multi_atomic_takedown(square_root)

Purpose
This routine gathers up the results for each thread and frees memory that was allocated by multi_atomic_setup .

It is assumed that this function is called by thread zero and all the other threads are blocked (waiting).

square_root
This argument has prototype       vector<double>& square_root  The input value of square_root does not matter. Upon return, it has the same size and is the element by element square root of y_squared .

ok
This return value has prototype       bool ok  If it is false, multi_atomic_takedown detected an error.

Source

namespace {
bool multi_atomic_takedown(vector<double>& square_root)
{     bool ok            = true;
//
// extract square roots in original order
square_root.resize(0);
{     // results for this thread
for(size_t i = 0; i < n; i++)
}
//
// go down so that free memory for other threads before memory for master
{     // check that this tread was ok with the work it did
//
// run destructor on vector object for this thread
//
// run destructor on function object for this thread
//
// delete problem specific information
void* v_ptr = static_cast<void*>( work_all_[thread_num] );
//
// check that there is no longer any memory inuse by this thread
}