lines 71-112 of file: example/multi_thread/harmonic.cpp

{xrst_begin harmonic_setup}

Set Up Multi-threading Sum of 1/i
#################################

Syntax
******

   *ok* = ``harmonic_setup`` ( *num_sum* )

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

.. math::

   1 + 1/2 + 1/3 + ... + 1/n

into separate parts for each thread.

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

num_sum
*******
The argument *num_sum* has prototype

   ``size_t`` *num_sum*

It specifies the value of :math:`n` in the summation.

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

{xrst_end harmonic_setup}
