Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 7aa0b3689999b2d0524276a8f3c2a10a > files > 621

glibmm2.4-doc-2.42.0-3.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>glibmm: Glib::ThreadPool Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">glibmm
   &#160;<span id="projectnumber">2.42.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceGlib.html">Glib</a></li><li class="navelem"><a class="el" href="classGlib_1_1ThreadPool.html">ThreadPool</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classGlib_1_1ThreadPool-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Glib::ThreadPool Class Reference<div class="ingroups"><a class="el" href="group__ThreadPools.html">Thread Pools</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>A pool of threads to execute work concurrently.  
 <a href="classGlib_1_1ThreadPool.html#details">More...</a></p>

<p><code>#include &lt;glibmm/threadpool.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afd549a2867eafe34663d8935c17efbe2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#afd549a2867eafe34663d8935c17efbe2">ThreadPool</a> (int max_threads=-1, bool exclusive=false)</td></tr>
<tr class="memdesc:afd549a2867eafe34663d8935c17efbe2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a new thread pool.  <a href="#afd549a2867eafe34663d8935c17efbe2">More...</a><br /></td></tr>
<tr class="separator:afd549a2867eafe34663d8935c17efbe2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaed3b188194822da768fa9a29e608b16"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#aaed3b188194822da768fa9a29e608b16">~ThreadPool</a> ()</td></tr>
<tr class="separator:aaed3b188194822da768fa9a29e608b16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b37fdac9f7a6e4a8791b4668e23e264"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a7b37fdac9f7a6e4a8791b4668e23e264">push</a> (const <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt;&amp; slot)</td></tr>
<tr class="memdesc:a7b37fdac9f7a6e4a8791b4668e23e264"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inserts <em>slot</em> into the list of tasks to be executed by the pool.  <a href="#a7b37fdac9f7a6e4a8791b4668e23e264">More...</a><br /></td></tr>
<tr class="separator:a7b37fdac9f7a6e4a8791b4668e23e264"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae19ed9a523788e40509ee4f39d2b10a9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#ae19ed9a523788e40509ee4f39d2b10a9">set_max_threads</a> (int max_threads)</td></tr>
<tr class="memdesc:ae19ed9a523788e40509ee4f39d2b10a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the maximal allowed number of threads for the pool.  <a href="#ae19ed9a523788e40509ee4f39d2b10a9">More...</a><br /></td></tr>
<tr class="separator:ae19ed9a523788e40509ee4f39d2b10a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6dbe83ceeb65fd0f157e1b1895ed3db5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a6dbe83ceeb65fd0f157e1b1895ed3db5">get_max_threads</a> () const </td></tr>
<tr class="memdesc:a6dbe83ceeb65fd0f157e1b1895ed3db5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximal number of threads for the pool.  <a href="#a6dbe83ceeb65fd0f157e1b1895ed3db5">More...</a><br /></td></tr>
<tr class="separator:a6dbe83ceeb65fd0f157e1b1895ed3db5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a6bc66c4eb03e346429e6f7fe3a5fe3"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a2a6bc66c4eb03e346429e6f7fe3a5fe3">get_num_threads</a> () const </td></tr>
<tr class="memdesc:a2a6bc66c4eb03e346429e6f7fe3a5fe3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of threads currently running in the pool.  <a href="#a2a6bc66c4eb03e346429e6f7fe3a5fe3">More...</a><br /></td></tr>
<tr class="separator:a2a6bc66c4eb03e346429e6f7fe3a5fe3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8eb62f226a5f5e2f93b66b25c49cc401"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a8eb62f226a5f5e2f93b66b25c49cc401">unprocessed</a> () const </td></tr>
<tr class="memdesc:a8eb62f226a5f5e2f93b66b25c49cc401"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of tasks still unprocessed in the pool.  <a href="#a8eb62f226a5f5e2f93b66b25c49cc401">More...</a><br /></td></tr>
<tr class="separator:a8eb62f226a5f5e2f93b66b25c49cc401"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab59582875f80b94bf4707c1c77f234ba"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#ab59582875f80b94bf4707c1c77f234ba">get_exclusive</a> () const </td></tr>
<tr class="memdesc:ab59582875f80b94bf4707c1c77f234ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns whether all threads are exclusive to this pool.  <a href="#ab59582875f80b94bf4707c1c77f234ba">More...</a><br /></td></tr>
<tr class="separator:ab59582875f80b94bf4707c1c77f234ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14a3e00a1fec5fec2bded78ea6a2b796"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a14a3e00a1fec5fec2bded78ea6a2b796">shutdown</a> (bool immediately=false)</td></tr>
<tr class="memdesc:a14a3e00a1fec5fec2bded78ea6a2b796"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees all resources allocated for the pool.  <a href="#a14a3e00a1fec5fec2bded78ea6a2b796">More...</a><br /></td></tr>
<tr class="separator:a14a3e00a1fec5fec2bded78ea6a2b796"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7f444f305942afb54c45204f509bc39"><td class="memItemLeft" align="right" valign="top">GThreadPool*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#ac7f444f305942afb54c45204f509bc39">gobj</a> ()</td></tr>
<tr class="separator:ac7f444f305942afb54c45204f509bc39"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba0bd84d5851f3a64269685dc102cd4b"><td class="memItemLeft" align="right" valign="top">const GThreadPool*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#aba0bd84d5851f3a64269685dc102cd4b">gobj</a> () const </td></tr>
<tr class="separator:aba0bd84d5851f3a64269685dc102cd4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:af057a2e30dc3e32137944f71658467db"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#af057a2e30dc3e32137944f71658467db">set_max_unused_threads</a> (int max_threads)</td></tr>
<tr class="memdesc:af057a2e30dc3e32137944f71658467db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the maximal number of unused threads to <em>max_threads</em>.  <a href="#af057a2e30dc3e32137944f71658467db">More...</a><br /></td></tr>
<tr class="separator:af057a2e30dc3e32137944f71658467db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa0bb8c1914b2e36fa0222bbaeb44b94e"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#aa0bb8c1914b2e36fa0222bbaeb44b94e">get_max_unused_threads</a> ()</td></tr>
<tr class="memdesc:aa0bb8c1914b2e36fa0222bbaeb44b94e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the maximal allowed number of unused threads.  <a href="#aa0bb8c1914b2e36fa0222bbaeb44b94e">More...</a><br /></td></tr>
<tr class="separator:aa0bb8c1914b2e36fa0222bbaeb44b94e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9904f39dc346cd44296f361415147ae1"><td class="memItemLeft" align="right" valign="top">static unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a9904f39dc346cd44296f361415147ae1">get_num_unused_threads</a> ()</td></tr>
<tr class="memdesc:a9904f39dc346cd44296f361415147ae1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of currently unused threads.  <a href="#a9904f39dc346cd44296f361415147ae1">More...</a><br /></td></tr>
<tr class="separator:a9904f39dc346cd44296f361415147ae1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a132a7f8416d29f9499ed87ba102c37a3"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadPool.html#a132a7f8416d29f9499ed87ba102c37a3">stop_unused_threads</a> ()</td></tr>
<tr class="memdesc:a132a7f8416d29f9499ed87ba102c37a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stops all currently unused threads.  <a href="#a132a7f8416d29f9499ed87ba102c37a3">More...</a><br /></td></tr>
<tr class="separator:a132a7f8416d29f9499ed87ba102c37a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A pool of threads to execute work concurrently. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="afd549a2867eafe34663d8935c17efbe2"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Glib::ThreadPool::ThreadPool </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_threads</em> = <code>-1</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>exclusive</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructs a new thread pool. </p>
<p>Whenever you call <a class="el" href="classGlib_1_1ThreadPool.html#a7b37fdac9f7a6e4a8791b4668e23e264" title="Inserts slot into the list of tasks to be executed by the pool. ">ThreadPool::push()</a>, either a new thread is created or an unused one is reused. At most <em>max_threads</em> threads are running concurrently for this thread pool. <em>max_threads&#160;=&#160;-1</em> allows unlimited threads to be created for this thread pool.</p>
<p>The parameter <em>exclusive</em> determines, whether the thread pool owns all threads exclusive or whether the threads are shared globally. If <em>exclusive</em> is <code>true</code>, <em>max_threads</em> threads are started immediately and they will run exclusively for this thread pool until it is destroyed by <a class="el" href="classGlib_1_1ThreadPool.html#aaed3b188194822da768fa9a29e608b16">~ThreadPool()</a>. If <em>exclusive</em> is <code>false</code>, threads are created when needed and shared between all non-exclusive thread pools. This implies that <em>max_threads</em> may not be -1 for exclusive thread pools.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">max_threads</td><td>The maximal number of threads to execute concurrently in the new thread pool, -1 means no limit. </td></tr>
    <tr><td class="paramname">exclusive</td><td>Should this thread pool be exclusive? </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::ThreadError</a></td><td>An error can only occur when <em>exclusive</em> is set to <code>true</code> and not all <em>max_threads</em> threads could be created. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aaed3b188194822da768fa9a29e608b16"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual Glib::ThreadPool::~ThreadPool </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab59582875f80b94bf4707c1c77f234ba"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Glib::ThreadPool::get_exclusive </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns whether all threads are exclusive to this pool. </p>
<dl class="section return"><dt>Returns</dt><dd>Whether all threads are exclusive to this pool. </dd></dl>

</div>
</div>
<a class="anchor" id="a6dbe83ceeb65fd0f157e1b1895ed3db5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Glib::ThreadPool::get_max_threads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the maximal number of threads for the pool. </p>
<dl class="section return"><dt>Returns</dt><dd>The maximal number of threads. </dd></dl>

</div>
</div>
<a class="anchor" id="aa0bb8c1914b2e36fa0222bbaeb44b94e"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static int Glib::ThreadPool::get_max_unused_threads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the maximal allowed number of unused threads. </p>
<dl class="section return"><dt>Returns</dt><dd>The maximal number of unused threads. </dd></dl>

</div>
</div>
<a class="anchor" id="a2a6bc66c4eb03e346429e6f7fe3a5fe3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int Glib::ThreadPool::get_num_threads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the number of threads currently running in the pool. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of threads currently running. </dd></dl>

</div>
</div>
<a class="anchor" id="a9904f39dc346cd44296f361415147ae1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static unsigned int Glib::ThreadPool::get_num_unused_threads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the number of currently unused threads. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of currently unused threads. </dd></dl>

</div>
</div>
<a class="anchor" id="ac7f444f305942afb54c45204f509bc39"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">GThreadPool* Glib::ThreadPool::gobj </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="aba0bd84d5851f3a64269685dc102cd4b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const GThreadPool* Glib::ThreadPool::gobj </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a7b37fdac9f7a6e4a8791b4668e23e264"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::ThreadPool::push </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/classsigc_1_1slot.html">sigc::slot</a>&lt; void &gt; &amp;&#160;</td>
          <td class="paramname"><em>slot</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Inserts <em>slot</em> into the list of tasks to be executed by the pool. </p>
<p>When the number of currently running threads is lower than the maximal allowed number of threads, a new thread is started (or reused). Otherwise <em>slot</em> stays in the queue until a thread in this pool finishes its previous task and processes <em>slot</em>.</p>
<p>Because <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a> is not thread-safe, if the slot represents a non-static class method and is created by <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>, the class concerned should not derive from <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/structsigc_1_1trackable.html">sigc::trackable</a>. You can use, say, boost::bind() or, in C++11, <a class="elRef" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01682.html#ga4c3052b337dde285bace96cbb996055c">std::bind()</a> or a C++11 lambda expression instead of <a class="elRef" href="http://library.gnome.org/devel/libsigc++/unstable/group__mem__fun.html#gadf6b6d22c503b439019f0a2e77352419">sigc::mem_fun()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slot</td><td>A new task for the thread pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::ThreadError</a></td><td>An error can only occur when a new thread couldn't be created. In that case <em>slot</em> is simply appended to the queue of work to do. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ae19ed9a523788e40509ee4f39d2b10a9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::ThreadPool::set_max_threads </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_threads</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the maximal allowed number of threads for the pool. </p>
<p>A value of -1 means that the maximal number of threads is unlimited. Setting <em>max_threads</em> to 0 means stopping all work for pool. It is effectively frozen until <em>max_threads</em> is set to a non-zero value again.</p>
<p>A thread is never terminated while it is still running. Instead the maximal number of threads only has effect for the allocation of new threads in <a class="el" href="classGlib_1_1ThreadPool.html#a7b37fdac9f7a6e4a8791b4668e23e264" title="Inserts slot into the list of tasks to be executed by the pool. ">ThreadPool::push()</a>. A new thread is allocated whenever the number of currently running threads in the pool is smaller than the maximal number.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">max_threads</td><td>A new maximal number of threads for the pool. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname"><a class="el" href="classGlib_1_1ThreadError.html" title="Exception class for thread-related errors. ">Glib::ThreadError</a></td><td>An error can only occur when a new thread couldn't be created. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="af057a2e30dc3e32137944f71658467db"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void Glib::ThreadPool::set_max_unused_threads </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_threads</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the maximal number of unused threads to <em>max_threads</em>. </p>
<p>If <em>max_threads</em> is -1, no limit is imposed on the number of unused threads. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">max_threads</td><td>Maximal number of unused threads. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a14a3e00a1fec5fec2bded78ea6a2b796"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::ThreadPool::shutdown </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>immediately</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Frees all resources allocated for the pool. </p>
<p>If <em>immediately</em> is <code>true</code>, no new task is processed. Otherwise the pool is not freed before the last task is processed. Note however, that no thread of this pool is interrupted while processing a task. Instead at least all still running threads can finish their tasks before the pool is freed.</p>
<p>This method does not return before all tasks to be processed (dependent on <em>immediately</em>, whether all or only the currently running) are ready. After calling <a class="el" href="classGlib_1_1ThreadPool.html#a14a3e00a1fec5fec2bded78ea6a2b796" title="Frees all resources allocated for the pool. ">shutdown()</a> the pool must not be used anymore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">immediately</td><td>Should the pool shut down immediately? </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a132a7f8416d29f9499ed87ba102c37a3"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void Glib::ThreadPool::stop_unused_threads </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Stops all currently unused threads. </p>
<p>This does not change the maximal number of unused threads. This function can be used to regularly stop all unused threads e.g. from <a class="el" href="group__MainLoop.html#gaadb206fcc112f086f9d47c016b1f2175" title="Convenience timeout signal. ">Glib::signal_timeout()</a>. </p>

</div>
</div>
<a class="anchor" id="a8eb62f226a5f5e2f93b66b25c49cc401"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int Glib::ThreadPool::unprocessed </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the number of tasks still unprocessed in the pool. </p>
<dl class="section return"><dt>Returns</dt><dd>The number of unprocessed tasks. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 22 2014 21:38:33 for glibmm by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.7
</small></address>
</body>
</html>