<HTML>
<HEAD>
<TITLE>threadpool Documentation</TITLE>
<LINK HREF="threadpool.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<DIV CLASS="qindex">
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD ALIGN="LEFT">
<B>threadpool</B>
</TD>
<TD ALIGN="RIGHT">
<A CLASS="qindex" HREF="../index.html">Overview</A> |
<A CLASS="qindex" HREF="../reference/annotated.html">Reference</A> |
<A CLASS="qindex" HREF="../tutorial/intro.html">Tutorial</A> |
<A CLASS="qindex" HREF="../examples/intro.html">Examples</A> |
<A CLASS="qindex" HREF="../design/intro.html">Design</A>
</TD>
</TR>
</TABLE>
</DIV>
<DIV CLASS="qindex">
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD ALIGN="LEFT">
<B>Reference</B>
</TD>
<TD ALIGN="RIGHT">
<A CLASS="qindex" HREF="annotated.html">Class List</A> |
<A CLASS="qindex" HREF="functions.html">Member Functions</A> |
<A CLASS="qindex" HREF="namespacemembers.html">Typedefs</A> |
<A CLASS="qindex" HREF="files.html">File List</A>
</TD>
</TR>
</TABLE>
</DIV>
<!-- Generated by Doxygen 1.4.6-NO -->
<div class="nav">
<a class="el" href="a00035.html">boost</a>::<a class="el" href="a00036.html">threadpool</a>::<a class="el" href="a00024.html">thread_pool</a></div>
<h1>boost::threadpool::thread_pool< Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy > Class Template Reference</h1><!-- doxytag: class="boost::threadpool::thread_pool" --><a href="a00002.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<typename Task = task_func, template< typename > class SchedulingPolicy = fifo_scheduler, template< typename > class SizePolicy = static_size, template< typename > class SizePolicyController = resize_controller, template< typename > class ShutdownPolicy = wait_for_all_tasks><br>
class boost::threadpool::thread_pool< Task, SchedulingPolicy, SizePolicy, SizePolicyController, ShutdownPolicy ></h3>
Thread pool.
<p>
Thread pools are a mechanism for asynchronous and parallel processing within the same process. The pool class provides a convenient way for dispatching asynchronous tasks as functions objects. The scheduling of these tasks can be easily controlled by using customized schedulers. A task must not throw an exception.<p>
A pool is DefaultConstructible, CopyConstructible and Assignable. It has reference semantics; all copies of the same pool are equivalent and interchangeable. All operations on a pool except assignment are strongly thread safe or sequentially consistent; that is, the behavior of concurrent calls is as if the calls have been issued sequentially in an unspecified order.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>Task</em> </td><td>A function object which implements the operator 'void operator() (void) const'. The operator () is called by the pool to execute the task. Exceptions are ignored. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>SchedulingPolicy</em> </td><td>A task container which determines how tasks are scheduled. It is guaranteed that this container is accessed only by one thread at a time. The scheduler shall not throw exceptions.</td></tr>
</table>
</dl>
<dl compact><dt><b>Remarks:</b></dt><dd>The pool class is thread-safe.</dd></dl>
<dl compact><dt><b>See also:</b></dt><dd>Tasks: <a class="el" href="a00036.html#c6f15485d0c9225572afc57b30f50358">task_func</a>, <a class="el" href="a00021.html">prio_task_func</a> <p>
Scheduling policies: <a class="el" href="a00016.html">fifo_scheduler</a>, <a class="el" href="a00018.html">lifo_scheduler</a>, <a class="el" href="a00020.html">prio_scheduler</a> </dd></dl>
<p>
<p>
Definition at line <a class="el" href="a00039.html#l00073">73</a> of file <a class="el" href="a00039.html">pool.hpp</a>.<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SchedulingPolicy<<br>
<a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a> > </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#4bdb3cef94393456f2b7ec0d171d6b11">scheduler_type</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SizePolicyController<<br>
pool_core_type > </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef SizePolicy< pool_core_type > </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#654dc8a75dc2ea813dc6307f8707658d">size_policy_type</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef Task </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#ab990245fb601499bc768737f65b09b2">active</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#9d98ecc57fb790ad12e9c12dcead921b">clear</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#4d8cacdeef78219399343a0bea999212">empty</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#1cea841e4310d6ff8a09f3f81124f45b">pending</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#3daf5e17f6c2ba9a0ecdeb73b41478e6">schedule</a> (<a class="el" href="a00024.html#321da9e252f14645cd3e433305576a4b">task_type</a> const &task)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#f0d21c4108b9808946ed8dabbbe2687f">size</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00024.html#c7e01650ffec650c0279782eacb4be80">size_controller_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#965f249200025312bd3a3a0f8144e3a5">size_controller</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#6eba12acd49dfe14c7de44073a138aa1">thread_pool</a> (size_t initial_threads=0)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#f229154a61cb29bc3ce969974eca3175">wait</a> (xtime const &timestamp, size_t task_threshold=0) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00024.html#dc8ccb7588160208ea0fd1d84b58269e">wait</a> (size_t task_threshold=0) const </td></tr>
</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="4bdb3cef94393456f2b7ec0d171d6b11"></a><!-- doxytag: member="boos