/* $Id: thread_alloc.omh 2506 2012-10-24 19:36:49Z bradbell $ */
/* --------------------------------------------------------------------------
CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
CppAD is distributed under multiple licenses. This distribution is under
the terms of the
GNU General Public License Version 3.
A copy of this license is included in the COPYING file of this distribution.
Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
-------------------------------------------------------------------------- */
$begin thread_alloc$$
$spell
openmp
cppad/thread_alloc.hpp
CppAD
$$
$section A Fast Multi-Threading Memory Allocator$$
$index multi-threading, memory allocation$$
$index memory, multi-threading allocation$$
$index allocation, multi-threading$$
$head Syntax$$
$code # include <cppad/thread_alloc.hpp>$$
$head Purpose$$
The C++ $code new$$ and $code delete$$ operators are thread safe,
but this means that a thread may have to wait for a lock on these operations.
Once memory is obtained for a thread, the $code thread_alloc$$ memory
allocator keeps that memory $cref/available/ta_available/$$ for the thread so that
it can be re-used without waiting for a lock.
All the CppAD memory allocations use this utility.
The $cref/free_available/ta_free_available/$$ function should be used to return memory
to the system (once it is no longer required by a thread).
$head Include$$
The routines in sections below are defined by $code cppad/thread_alloc.hpp$$.
This file is included by
$code cppad/cppad.hpp$$, but it can also be included separately with out
the rest of the $code CppAD$$.
$childtable%
example/thread_alloc.cpp%
cppad/thread_alloc.hpp
%$$
$end
*/