lines 215-257 of file: example/multi_thread/harmonic.cpp

{xrst_begin harmonic_takedown}

Take Down Multi-threading Sum of 1/i
####################################

Syntax
******

   *ok* = ``harmonic_takedown`` ( *sum* )

Purpose
*******
This routine does the takedown for splitting
the summation that defines the harmonic series

.. math::

   s = 1 + 1/2 + 1/3 + ... + 1/n

into separate parts for each thread; see :ref:`harmonic_setup-name` .

Thread
******
It is assumed that this function is called by thread zero,
and all the other threads have completed their work and are blocked (waiting).

sum
***
This argument has prototype

   ``double&`` *sum*

The input value of the argument does not matter.
Upon return it is the value of the summation; i.e. :math:`s`.

Source
******
{xrst_literal
   // BEGIN TAKEDOWN C++
   // END TAKEDOWN C++
}

{xrst_end harmonic_takedown}
