| 
Prev | Next | 
include "team_thread.hpp"
ok   = team_create(num_threads)
ok   = team_work(worker)
ok   = team_destroy()
name = team_name()
AD<double>.
For example,
these could be OpenMP threads, pthreads, or Boost threads to name a few.
team_create,
team_work, and
team_destroy, must all be done by the master thread; i.e.,
thread_num
 must be zero.
In addition, they must all be done in sequential execution mode; i.e.,
when the master thread is the only thread that is running
(in_parallel
 must be false).
num_threads > 0
 has type size_t
and specifies the number of threads in this team.
This initializes both AD<double> and team_work
to be used with 
num_threads
.
If 
num_threads > 1
,
num_threads - 1
 new threads are created
and put in a waiting state until team_work is called.
team_create and team_destroy.
The argument 
worker
 has type
bool worker(void)
.
Each call to team_work runs 
num_threads
 versions
of 
worker
 with the corresponding value of
thread_num
between zero and 
num_threads - 1
 and
different for each thread,
     thread_num = 1 , ... , num_threads-1
     const char* name
and is a statically allocated '\0' terminated C string.
ok
 has type bool.
It is false if an error is detected during the
corresponding call.
Otherwise it is true.
| team_openmp.cpp | OpenMP Implementation of a Team of AD Threads | 
| team_bthread.cpp | Boost Thread Implementation of a Team of AD Threads | 
| team_pthread.cpp | Pthread Implementation of a Team of AD Threads | 
| harmonic.cpp | Multi-Threading Harmonic Summation Example / Test | 
| multi_newton.cpp | Multi-Threaded Newton Method Example / Test | 
# include <cstddef> // for size_t extern bool team_create(size_t num_threads); extern bool team_work(void worker(void)); extern bool team_destroy(void); extern const char* team_name(void);