Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > ba6e5e1a033bd8535c43a771ce407926 > files > 419

lib64cxx-gtk-utils2.2-devel-2.2.3-2.mga4.x86_64.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.4"/>
<title>c++-gtk-utils: Cgu::Thread Namespace 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">c++-gtk-utils
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
  <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 class="current"><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="namespaces.html"><span>Namespace&#160;List</span></a></li>
      <li><a href="namespacemembers.html"><span>Namespace&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceCgu.html">Cgu</a></li><li class="navelem"><a class="el" href="namespaceCgu_1_1Thread.html">Thread</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#nested-classes">Classes</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Cgu::Thread Namespace Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespaceCgu_1_1Thread_1_1FutureHelper"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread_1_1FutureHelper.html">FutureHelper</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:namespaceCgu_1_1Thread_1_1TaskManagerHelper"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread_1_1TaskManagerHelper.html">TaskManagerHelper</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1FutureThreadError.html">FutureThreadError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1FutureWhenError.html">FutureWhenError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1Future.html">Future</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A class representing a pthread thread which will provide a value.  <a href="classCgu_1_1Thread_1_1Future.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">CondError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">MutexError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1RecMutexError.html">RecMutexError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1Mutex.html">Mutex</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A wrapper class for pthread mutexes.  <a href="classCgu_1_1Thread_1_1Mutex.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1Cond.html">Cond</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A wrapper class for pthread condition variables.  <a href="classCgu_1_1Thread_1_1Cond.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1RecMutex.html">RecMutex</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A wrapper class for pthread mutexes which provides a recursive mutex.  <a href="classCgu_1_1Thread_1_1RecMutex.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1GrecmutexLock.html">GrecmutexLock</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A scoped locking class for exception safe locking of GStaticRecMutex objects.  <a href="classCgu_1_1Thread_1_1GrecmutexLock.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">ParallelError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1RWLockError.html">RWLockError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1RWLock.html">RWLock</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A wrapper class for pthread read-write locks.  <a href="classCgu_1_1Thread_1_1RWLock.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">TaskError</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A thread-pool class for managing tasks in multi-threaded programs.  <a href="classCgu_1_1Thread_1_1TaskManager.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1Thread.html">Thread</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A class representing a pthread thread.  <a href="classCgu_1_1Thread_1_1Thread.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1JoinableHandle.html">JoinableHandle</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A class wrapping a <a class="el" href="classCgu_1_1Thread_1_1Thread.html" title="A class representing a pthread thread. ">Thread::Thread</a> object representing a joinable thread.  <a href="classCgu_1_1Thread_1_1JoinableHandle.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1CancelBlock.html">CancelBlock</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A class enabling the cancellation state of a thread to be controlled.  <a href="classCgu_1_1Thread_1_1CancelBlock.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCgu_1_1Thread_1_1Exit.html">Exit</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A class which can be thrown to terminate the throwing thread.  <a href="classCgu_1_1Thread_1_1Exit.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ae859cc661aefb3465ab878a3f7305910"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#ae859cc661aefb3465ab878a3f7305910">Locked</a> { <a class="el" href="namespaceCgu_1_1Thread.html#ae859cc661aefb3465ab878a3f7305910a852f8168e5f00130c64125b059109a35">locked</a>
 }</td></tr>
<tr class="separator:ae859cc661aefb3465ab878a3f7305910"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a805d60a9ddc5469f5d1cde5451670af7"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a805d60a9ddc5469f5d1cde5451670af7">DeferLock</a> { <a class="el" href="namespaceCgu_1_1Thread.html#a805d60a9ddc5469f5d1cde5451670af7aeca263f786f779ee077c1880c8627546">defer</a>
 }</td></tr>
<tr class="separator:a805d60a9ddc5469f5d1cde5451670af7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a6769a7659ba96804dde745f0d61b84d5"><td class="memTemplParams" colspan="2">template&lt;class Obj , class Ret , class... Params, class... Args&gt; </td></tr>
<tr class="memitem:a6769a7659ba96804dde745f0d61b84d5"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a><br class="typebreak"/>
&lt; <a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt; Ret &gt; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a6769a7659ba96804dde745f0d61b84d5">make_future</a> (Obj &amp;obj, Ret(Obj::*func)(Params...), Args &amp;&amp;...args)</td></tr>
<tr class="separator:a6769a7659ba96804dde745f0d61b84d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3be2e950b3b4883522e4d73060a593d5"><td class="memTemplParams" colspan="2">template&lt;class Obj , class Ret , class... Params, class... Args&gt; </td></tr>
<tr class="memitem:a3be2e950b3b4883522e4d73060a593d5"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a><br class="typebreak"/>
&lt; <a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt; Ret &gt; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a3be2e950b3b4883522e4d73060a593d5">make_future</a> (const Obj &amp;obj, Ret(Obj::*func)(Params...) const, Args &amp;&amp;...args)</td></tr>
<tr class="separator:a3be2e950b3b4883522e4d73060a593d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4602fb039a64b43370935fbe8f2f855f"><td class="memTemplParams" colspan="2">template&lt;class Ret , class... Params, class... Args&gt; </td></tr>
<tr class="memitem:a4602fb039a64b43370935fbe8f2f855f"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a><br class="typebreak"/>
&lt; <a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt; Ret &gt; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a4602fb039a64b43370935fbe8f2f855f">make_future</a> (Ret(*func)(Params...), Args &amp;&amp;...args)</td></tr>
<tr class="separator:a4602fb039a64b43370935fbe8f2f855f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a51e87f99fa4b655aee5c4dadd182db83"><td class="memTemplParams" colspan="2">template&lt;class Ret , class Func &gt; </td></tr>
<tr class="memitem:a51e87f99fa4b655aee5c4dadd182db83"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a><br class="typebreak"/>
&lt; <a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt; Ret &gt; &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a51e87f99fa4b655aee5c4dadd182db83">make_future</a> (Func &amp;&amp;func)</td></tr>
<tr class="separator:a51e87f99fa4b655aee5c4dadd182db83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a984bbff1392b7e173a8b3ad081e542c2"><td class="memTemplParams" colspan="2">template&lt;class Iterator , class Func &gt; </td></tr>
<tr class="memitem:a984bbff1392b7e173a8b3ad081e542c2"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a984bbff1392b7e173a8b3ad081e542c2">parallel_for_each</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, Iterator first, Iterator last, Func &amp;&amp;func)</td></tr>
<tr class="separator:a984bbff1392b7e173a8b3ad081e542c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a497aa47446b79c87f1a404e11151a942"><td class="memTemplParams" colspan="2">template&lt;class SourceIterator , class DestIterator , class Func &gt; </td></tr>
<tr class="memitem:a497aa47446b79c87f1a404e11151a942"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a497aa47446b79c87f1a404e11151a942">parallel_transform</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, SourceIterator first, SourceIterator last, DestIterator dest, Func &amp;&amp;func)</td></tr>
<tr class="separator:a497aa47446b79c87f1a404e11151a942"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a219127851a3a7578668b7ac0e155441d"><td class="memTemplParams" colspan="2">template&lt;class SourceIterator1 , class SourceIterator2 , class DestIterator , class Func &gt; </td></tr>
<tr class="memitem:a219127851a3a7578668b7ac0e155441d"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a219127851a3a7578668b7ac0e155441d">parallel_transform</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, SourceIterator1 first1, SourceIterator1 last1, SourceIterator2 first2, DestIterator dest, Func &amp;&amp;func)</td></tr>
<tr class="separator:a219127851a3a7578668b7ac0e155441d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a920c9b1ec2ee80e0c798204f1a5553"><td class="memTemplParams" colspan="2">template&lt;class Iterator , class Func &gt; </td></tr>
<tr class="memitem:a7a920c9b1ec2ee80e0c798204f1a5553"><td class="memTemplItemLeft" align="right" valign="top">Iterator&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a7a920c9b1ec2ee80e0c798204f1a5553">parallel_for_each_partial</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, Iterator first, Iterator last, int max, Func &amp;&amp;func)</td></tr>
<tr class="separator:a7a920c9b1ec2ee80e0c798204f1a5553"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad03d1d6f6b0718a0b63a850b05fae623"><td class="memTemplParams" colspan="2">template&lt;class SourceIterator , class DestIterator , class Func &gt; </td></tr>
<tr class="memitem:ad03d1d6f6b0718a0b63a850b05fae623"><td class="memTemplItemLeft" align="right" valign="top">std::pair&lt; SourceIterator, <br class="typebreak"/>
DestIterator &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#ad03d1d6f6b0718a0b63a850b05fae623">parallel_transform_partial</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, SourceIterator first, SourceIterator last, DestIterator dest, int max, Func &amp;&amp;func)</td></tr>
<tr class="separator:ad03d1d6f6b0718a0b63a850b05fae623"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1548f422f99e63b0eaf53019e5114b34"><td class="memTemplParams" colspan="2">template&lt;class SourceIterator1 , class SourceIterator2 , class DestIterator , class Func &gt; </td></tr>
<tr class="memitem:a1548f422f99e63b0eaf53019e5114b34"><td class="memTemplItemLeft" align="right" valign="top">std::tuple&lt; SourceIterator1, <br class="typebreak"/>
SourceIterator2, DestIterator &gt;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceCgu_1_1Thread.html#a1548f422f99e63b0eaf53019e5114b34">parallel_transform_partial</a> (<a class="el" href="classCgu_1_1Thread_1_1TaskManager.html">TaskManager</a> &amp;tm, SourceIterator1 first1, SourceIterator1 last1, SourceIterator2 first2, DestIterator dest, int max, Func &amp;&amp;func)</td></tr>
<tr class="separator:a1548f422f99e63b0eaf53019e5114b34"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="a805d60a9ddc5469f5d1cde5451670af7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="namespaceCgu_1_1Thread.html#a805d60a9ddc5469f5d1cde5451670af7">Cgu::Thread::DeferLock</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="a805d60a9ddc5469f5d1cde5451670af7aeca263f786f779ee077c1880c8627546"></a>defer</em>&nbsp;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<a class="anchor" id="ae859cc661aefb3465ab878a3f7305910"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="namespaceCgu_1_1Thread.html#ae859cc661aefb3465ab878a3f7305910">Cgu::Thread::Locked</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="ae859cc661aefb3465ab878a3f7305910a852f8168e5f00130c64125b059109a35"></a>locked</em>&nbsp;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a6769a7659ba96804dde745f0d61b84d5"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Obj , class Ret , class... Params, class... Args&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a>&lt;<a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt;Ret&gt; &gt; Cgu::Thread::make_future </td>
          <td>(</td>
          <td class="paramtype">Obj &amp;&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Ret(Obj::*)(Params...)&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000001">Deprecated:</a></b></dt><dd></dd></dl>
<p>DEPRECATED. Use the version of <a class="el" href="namespaceCgu_1_1Thread.html#a6769a7659ba96804dde745f0d61b84d5">make_future()</a> which takes a callable object.</p>
<p>A convenience helper function which calls <a class="el" href="classCgu_1_1Thread_1_1Future.html#aa2b0f15fafa48e3c753986c58a91db00">Cgu::Thread::Future::make()</a> to obtain a <a class="el" href="classCgu_1_1Thread_1_1Future.html" title="A class representing a pthread thread which will provide a value. ">Future</a> object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>It might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a> if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.</dd></dl>
<p>Since 2.0.4 </p>

</div>
</div>
<a class="anchor" id="a3be2e950b3b4883522e4d73060a593d5"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Obj , class Ret , class... Params, class... Args&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a>&lt;<a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt;Ret&gt; &gt; Cgu::Thread::make_future </td>
          <td>(</td>
          <td class="paramtype">const Obj &amp;&#160;</td>
          <td class="paramname"><em>obj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Ret(Obj::*)(Params...) const&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd></dd></dl>
<p>DEPRECATED. Use the version of <a class="el" href="namespaceCgu_1_1Thread.html#a6769a7659ba96804dde745f0d61b84d5">make_future()</a> which takes a callable object.</p>
<p>A convenience helper function which calls <a class="el" href="classCgu_1_1Thread_1_1Future.html#aa2b0f15fafa48e3c753986c58a91db00">Cgu::Thread::Future::make()</a> to obtain a <a class="el" href="classCgu_1_1Thread_1_1Future.html" title="A class representing a pthread thread which will provide a value. ">Future</a> object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>It might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a> if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.</dd></dl>
<p>Since 2.0.4 </p>

</div>
</div>
<a class="anchor" id="a4602fb039a64b43370935fbe8f2f855f"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Ret , class... Params, class... Args&gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a>&lt;<a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt;Ret&gt; &gt; Cgu::Thread::make_future </td>
          <td>(</td>
          <td class="paramtype">Ret(*)(Params...)&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Args &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000003">Deprecated:</a></b></dt><dd></dd></dl>
<p>DEPRECATED. Use the version of <a class="el" href="namespaceCgu_1_1Thread.html#a6769a7659ba96804dde745f0d61b84d5">make_future()</a> which takes a callable object.</p>
<p>A convenience helper function which calls <a class="el" href="classCgu_1_1Thread_1_1Future.html#aa2b0f15fafa48e3c753986c58a91db00">Cgu::Thread::Future::make()</a> to obtain a <a class="el" href="classCgu_1_1Thread_1_1Future.html" title="A class representing a pthread thread which will provide a value. ">Future</a> object without the need to specify the return value of the function represented by the new object: that is deduced from the signature of that function. This is useful shorthand when also employed with the C++11 'auto' keyword. </p>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>It might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a> if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This method will also throw if the copy or move constructor of a bound argument throws, or the default constructor of the return value type of the function represented by the new object throws.</dd></dl>
<p>Since 2.0.4 </p>

</div>
</div>
<a class="anchor" id="a51e87f99fa4b655aee5c4dadd182db83"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Ret , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCgu_1_1IntrusivePtr.html">Cgu::IntrusivePtr</a>&lt;<a class="el" href="classCgu_1_1Thread_1_1Future.html">Cgu::Thread::Future</a>&lt;Ret&gt; &gt; Cgu::Thread::make_future </td>
          <td>(</td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>)</td><td></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>A convenience helper function which calls <a class="el" href="classCgu_1_1Thread_1_1Future.html#aa2b0f15fafa48e3c753986c58a91db00">Cgu::Thread::Future::make()</a> to obtain a <a class="el" href="classCgu_1_1Thread_1_1Future.html" title="A class representing a pthread thread which will provide a value. ">Future</a> without the need to specify the return value of the callable object to be represented by it: that is deduced. This is useful shorthand when also employed with the C++11 'auto' keyword.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">func</td><td>A callable object, such as formed by a lambda expression or the result of std::bind. It must be fully bound (that is, its must take no arguments when called). It should return a value (it cannot return void). </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>It might throw std::bad_alloc if memory is exhausted and the system throws in that case. (This exception will not be thrown if the library has been installed using the --with-glib-memory-slices-no-compat configuration option: instead glib will terminate the program if it is unable to obtain memory from the operating system.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a> if initialisation of the contained mutex fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>It might throw <a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a> if initialisation of the contained condition variable fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>1. This method will also throw if the copy or move constructor of the callable object passed as an argument throws, or the default constructor of the return value type of the function represented by the new object throws. </dd>
<dd>
2. If the callable object passed as an argument has both const and non-const operator()() methods, the non-const version will be called even if the callable object passed is a const object.</dd></dl>
<p>Since 2.0.14 </p>

</div>
</div>
<a class="anchor" id="a984bbff1392b7e173a8b3ad081e542c2"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Iterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void Cgu::Thread::parallel_for_each </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Iterator&#160;</td>
          <td class="paramname"><em>first</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Iterator&#160;</td>
          <td class="paramname"><em>last</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function applies a callable object to each element of a container in the range ['first', 'last'), by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the container (and if a task mutates its argument, it will do so in respect of the correct element of the container), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>Apart from that, and that this function returns void, it does the same as std::for_each(). It can mutate container elements if the callable object takes its argument by non-const reference. It will not return until the callable object has been applied to all of the elements in the range ['first', 'last').</p>
<p>This function can be called by a task running on the same <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">TaskManager</a> object.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first</td><td>The beginning of the range to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">last</td><td>One past the last element to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">func</td><td>A callable object to be applied to each element in the range ['first', 'last'), such as formed by a lambda expression or the result of std::bind. It should take a single unbound argument of the value type of the container to which 'first' and 'last' relate or a const or non-const reference to that type. Any return value is discarded. If an exception propagates from 'func', the exception will be consumed while the for each loop is running, and an attempt will still be made to apply 'func' to all remaining elements in the range ['first', 'last'), and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the container. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the range ['first', 'last'). <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.19/2.2.2 </p>

</div>
</div>
<a class="anchor" id="a7a920c9b1ec2ee80e0c798204f1a5553"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class Iterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">Iterator Cgu::Thread::parallel_for_each_partial </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Iterator&#160;</td>
          <td class="paramname"><em>first</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Iterator&#160;</td>
          <td class="paramname"><em>last</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function applies a callable object to each element of a container in the range ['first', 'last') subject to a maximum, by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the container (and if a task mutates its argument, it will do so in respect of the correct element of the container), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>This function does the same as <a class="el" href="namespaceCgu_1_1Thread.html#a984bbff1392b7e173a8b3ad081e542c2">Thread::parallel_for_each()</a>, except that it returns an iterator to the element past the last element to which the callable object has been applied, and it has a 'max' parameter to limit the maximum number of elements to which the callable object will be applied on any one call to this function even if the range ['first', 'last') is greater than this maximum. Whether this limitation has had effect on any one call can be tested by checking whether the return value is equal to the 'last' parameter. If it is not, a further call to this function can be made.</p>
<p>The main purpose of this additional function is to enable the application of the callable object to the elements of a container to be dealt with in chunks, possibly to enable other tasks to be interleaved at reasonable intervals. For a container which does not support random access iterators, the 'last' parameter can be set to, say, the end of the container and the chunk size set with the 'max' paramater, with the return value being used as the 'first' parameter for subsequent calls to this function. This avoids having to increment the iterator for each "chunk" by stepping through the container by hand. In this usage, it therefore represents a minor efficiency improvement.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first</td><td>The beginning of the range to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">last</td><td>One past the last element to which 'func' is to be applied, subject to any maximum specified as the 'max' parameter. </td></tr>
    <tr><td class="paramname">max</td><td>The maximum number of elements of the source container to which 'func' will be applied on this call. It is not an error if it is greater than the distance between 'first' and 'last'. If it is equal to or greater than that distance, it follows that the iterator returned will be equal to 'last'. The same results if 'max' is a negative number (in that case no maximum will take effect and each element in the range ['first', 'last') will have 'func' applied to it). </td></tr>
    <tr><td class="paramname">func</td><td>A callable object to be applied (subject to the maximum) to each element in the range ['first', 'last'), such as formed by a lambda expression or the result of std::bind. It should take a single unbound argument of the value type of the container to which 'first' and 'last' relate or a const or non-const reference to that type. Any return value is discarded. If an exception propagates from 'func', the exception will be consumed while the for each loop is running, and an attempt will still be made to apply 'func' to all remaining elements in the range ['first', 'last') subject to the maximum, and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An iterator representing the element past the last element of the range to which 'func' was applied, which may be passed as the 'first' argument of a subsequent call to this function. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the container. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the range ['first', 'last') subject to the maximum. <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.20/2.2.3 </p>

</div>
</div>
<a class="anchor" id="a497aa47446b79c87f1a404e11151a942"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class SourceIterator , class DestIterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void Cgu::Thread::parallel_transform </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator&#160;</td>
          <td class="paramname"><em>first</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator&#160;</td>
          <td class="paramname"><em>last</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DestIterator&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function maps over a container in the range ['first', 'last'), applying a unary callable object to each element of the container in that range and storing the result in the destination range, by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the source container, and the final result appears in the destination container in the same order as the source range from which it is generated (including if a back_inserter iterator is used), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>Apart from that, this function does the same as the version of std::transform() taking a unary function, except that it returns void (see <a class="el" href="namespaceCgu_1_1Thread.html#ad03d1d6f6b0718a0b63a850b05fae623">Thread::parallel_transform_partial()</a> for a function which returns a destination iterator and an iterator to the source range). It will not return until the callable object has been applied to all of the elements in the range ['first', 'last').</p>
<p>This function can be called by a task running on the same <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">TaskManager</a> object (a result can therefore be delivered asynchronously by calling this function in a task created by the make_task_when(), make_task_compose() or make_task_when_full() <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> methods). A task can carry out a map-reduce operation by passing the result of calling this function to std::accumulate() to perform a fold-left or fold-right on that result.</p>
<p>A separate overload of this function takes a binary callable object.</p>
<p>Here is a trivial example of a map-reduce operation which maps over a vector by multiplying each element by 2 in separate tasks, and then folds-left using std::accumulate() (std::accumulate() can fold using any callable object, but in this example the default of addition is used):</p>
<div class="fragment"><div class="line"> <span class="keyword">using namespace </span>Cgu;</div>
<div class="line"> std::vector&lt;int&gt; v{1, 2, 3, 4, 5};</div>
<div class="line"> <a class="code" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> tm;</div>
<div class="line"></div>
<div class="line"> <a class="code" href="namespaceCgu_1_1Thread.html#a497aa47446b79c87f1a404e11151a942">Thread::parallel_transform</a>(tm,</div>
<div class="line">                            v.begin(),</div>
<div class="line">                            v.end(),</div>
<div class="line">                            v.begin(),</div>
<div class="line">                            [] (<span class="keywordtype">int</span> elt) {<span class="keywordflow">return</span> elt * 2;});</div>
<div class="line"><span class="comment">// res will be equal to 30</span></div>
<div class="line"><span class="keywordtype">int</span> res = std::accumulate(v.begin(), v.end(), 0);</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first</td><td>The beginning of the range to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">last</td><td>One past the last element to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">dest</td><td>The beginning of the range to which the result of applying 'func' to the elements in the range ['first', 'last') is to be stored. As in the case of std::transform, this can overlap with or be the same as the source range. It may also be an insert iterator. </td></tr>
    <tr><td class="paramname">func</td><td>A unary callable object to be applied to each element in the range ['first', 'last'), such as formed by a lambda expression or the result of std::bind. It should take a single unbound argument of the value type of the container to which 'first' and 'last' relate or a const or non-const reference to that type. If an exception propagates from 'func', the exception will be consumed while the transform loop is running, and an attempt will still be made to apply 'func' to all remaining elements in the range ['first', 'last'), and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the source container. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the range ['first', 'last'). <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.19/2.2.2 </p>

</div>
</div>
<a class="anchor" id="a219127851a3a7578668b7ac0e155441d"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class SourceIterator1 , class SourceIterator2 , class DestIterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">void Cgu::Thread::parallel_transform </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator1&#160;</td>
          <td class="paramname"><em>first1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator1&#160;</td>
          <td class="paramname"><em>last1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator2&#160;</td>
          <td class="paramname"><em>first2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DestIterator&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function maps over two containers, one in the range ['first1', 'last1') and the other beginning at 'first2', applying a binary callable object to each element of the containers in those ranges and storing the result in the destination range, by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the source containers, and the final result appears in the destination container in the same order as the source ranges from which it is generated (including if a back_inserter iterator is used), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>Apart from that, this function does the same as the version of std::transform() taking a binary function, except that it returns void (see <a class="el" href="namespaceCgu_1_1Thread.html#ad03d1d6f6b0718a0b63a850b05fae623">Thread::parallel_transform_partial()</a> for a function which returns a destination iterator and iterators to the source ranges). It will not return until the callable object has been applied to all of the elements in the source ranges.</p>
<p>This function can be called by a task running on the same <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">TaskManager</a> object (a result can therefore be delivered asynchronously by calling this function in a task created by the make_task_when(), make_task_compose() or make_task_when_full() <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> methods). A task can carry out a map-reduce operation by passing the result of calling this function to std::accumulate() to perform a fold-left or fold-right on that result.</p>
<p>A separate overload of this function takes a unary callable object.</p>
<p>Here is a trivial example of a map-reduce operation which maps over two vectors by adding respective elements of the vectors in separate tasks, and then folds-left using std::accumulate() (std::accumulate() can fold using any callable object, but in this example the default of addition is used):</p>
<div class="fragment"><div class="line"> <span class="keyword">using namespace </span>Cgu;</div>
<div class="line"> std::vector&lt;int&gt; v1{2, 4, 6, 8, 10};</div>
<div class="line"> std::vector&lt;int&gt; v2{10, 20, 30, 40, 50};</div>
<div class="line"> std::vector&lt;int&gt; v3;</div>
<div class="line"> <a class="code" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> tm;</div>
<div class="line"></div>
<div class="line"> <a class="code" href="namespaceCgu_1_1Thread.html#a497aa47446b79c87f1a404e11151a942">Thread::parallel_transform</a>(tm,</div>
<div class="line">                            v1.begin(),</div>
<div class="line">                            v1.end(),</div>
<div class="line">                            v2.begin(),</div>
<div class="line">                            std::back_inserter(v3),</div>
<div class="line">                            std::plus&lt;int&gt;());</div>
<div class="line"><span class="comment">// res will be equal to 180</span></div>
<div class="line"><span class="keywordtype">int</span> res = std::accumulate(v3.begin(), v3.end(), 0);</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first1</td><td>The beginning of the range which is to be passed as the first argument of 'func'. </td></tr>
    <tr><td class="paramname">last1</td><td>One past the last element of the range which is to be passed as the first argument of 'func'. </td></tr>
    <tr><td class="paramname">first2</td><td>The beginning of the range which is to be passed as the second argument of 'func'. </td></tr>
    <tr><td class="paramname">dest</td><td>The beginning of the range to which the result of applying 'func' to the elements in the source ranges is to be stored. As in the case of std::transform, this can overlap with or be the same as one of the source ranges. It may also be an insert iterator. </td></tr>
    <tr><td class="paramname">func</td><td>A binary callable object to be applied to each element in the source ranges, such as formed by a lambda expression or the result of std::bind. It should take two unbound arguments of the value types of the containers to which 'first1' and 'first2' relate or const or non-const references to those types. If an exception propagates from 'func', the exception will be consumed while the transform loop is running, and an attempt will still be made to apply 'func' to all remaining elements of the source ranges, and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the source ranges. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the source ranges. <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.19/2.2.2 </p>

</div>
</div>
<a class="anchor" id="ad03d1d6f6b0718a0b63a850b05fae623"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class SourceIterator , class DestIterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::pair&lt;SourceIterator, DestIterator&gt; Cgu::Thread::parallel_transform_partial </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator&#160;</td>
          <td class="paramname"><em>first</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator&#160;</td>
          <td class="paramname"><em>last</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DestIterator&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function maps over a container in the range ['first', 'last') subject to a maximum, applying a unary callable object to each element of the container in that range (subject to the maximum) and storing the result in the destination range, by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the source container, and the final result appears in the destination container in the same order as the source range from which it is generated (including if a back_inserter iterator is used), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>A separate overload of this function takes a binary callable object.</p>
<p>This function does the same as the version of <a class="el" href="namespaceCgu_1_1Thread.html#a497aa47446b79c87f1a404e11151a942">Thread::parallel_transform()</a> taking a unary callable object, except that it returns a std::pair object containing an iterator to the element past the last element of the source range transformed, and a destination iterator to the element past the last element stored in the destination range, and it has a 'max' parameter to limit the maximum number of elements which will be so transformed on any one call to this function. Whether this limitation has had effect on any one call can be tested by checking whether the first value of the pair returned is equal to the 'last' parameter. If it is not, a further call to this function can be made.</p>
<p>The main purpose of this additional function is to enable the parallel transform of the elements of a container to be dealt with in chunks, possibly to enable other tasks to be interleaved at reasonable intervals. For source or destination containers which do not support random access iterators, the 'last' parameter can be set to, say, the end of the container and the chunk size set with the 'max' paramater, with the values of the returned pair being used as the 'first' and 'dest' parameters for subsequent calls to this function. This avoids having to increment the source and destination iterators for each "chunk" by stepping through the respective containers by hand. In this usage, it therefore represents a minor efficiency improvement.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first</td><td>The beginning of the range to which 'func' is to be applied. </td></tr>
    <tr><td class="paramname">last</td><td>One past the last element to which 'func' is to be applied, subject to any maximum specified as the 'max' parameter. </td></tr>
    <tr><td class="paramname">dest</td><td>The beginning of the range to which the result of applying 'func' to the elements in the source range is to be stored. As in the case of std::transform, this can overlap with or be the same as the source range. It may also be an insert iterator. </td></tr>
    <tr><td class="paramname">max</td><td>The maximum number of elements of the source container which will be transformed on this call. It is not an error if it is greater than the distance between 'first' and 'last'. If it is equal to or greater than that distance, it follows that the first value of the pair returned by this function will be equal to 'last'. The same results if 'max' is a negative number (in that case no maximum will take effect and all elements in the range ['first', 'last') will be transformed), so passing -1 might be useful as a means of obtaining a destination iterator (the second value) for other purposes, particularly where it is not a random access iterator). </td></tr>
    <tr><td class="paramname">func</td><td>A unary callable object to be applied (subject to the maximum) to each element in the range ['first', 'last'), such as formed by a lambda expression or the result of std::bind. It should take a single unbound argument of the value type of the container to which 'first' and 'last' relate or a const or non-const reference to that type. If an exception propagates from 'func', the exception will be consumed while the transform loop is running, and an attempt will still be made to apply 'func' to all remaining elements in the range ['first', 'last') subject to the maximum, and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A std::pair object. Its first member is an iterator representing the element past the last element of the source range transformed, which may be passed as the 'first' argument of a subsequent call to this function; and its second member is an iterator representing the element past the last element stored in the destination range, which may be passed as the 'dest' argument of the subsequent call. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the source container. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the range ['first', 'last') subject to the maximum. <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.20/2.2.3 </p>

</div>
</div>
<a class="anchor" id="a1548f422f99e63b0eaf53019e5114b34"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;class SourceIterator1 , class SourceIterator2 , class DestIterator , class Func &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">std::tuple&lt;SourceIterator1, SourceIterator2, DestIterator&gt; Cgu::Thread::parallel_transform_partial </td>
          <td>(</td>
          <td class="paramtype">TaskManager &amp;&#160;</td>
          <td class="paramname"><em>tm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator1&#160;</td>
          <td class="paramname"><em>first1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator1&#160;</td>
          <td class="paramname"><em>last1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">SourceIterator2&#160;</td>
          <td class="paramname"><em>first2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DestIterator&#160;</td>
          <td class="paramname"><em>dest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Func &amp;&amp;&#160;</td>
          <td class="paramname"><em>func</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>#include &lt;c++-gtk-utils/parallel.h&gt;</p>
<p>This function maps over two containers, one in the range ['first1', 'last1') subject to a maximum, and the other beginning at 'first2', applying a binary callable object to each element of the containers in those ranges (subject to the maximum) and storing the result in the destination range, by executing each such application as a task of a <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object. Tasks are added to the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object in the order in which the respective elements appear in the source containers, and the final result appears in the destination container in the same order as the source ranges from which it is generated (including if a back_inserter iterator is used), but no other ordering arises, and the tasks will execute in parallel to the extent that the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object has sufficient threads available to do so.</p>
<p>A separate overload of this function takes a unary callable object.</p>
<p>This function does the same as the version of <a class="el" href="namespaceCgu_1_1Thread.html#a497aa47446b79c87f1a404e11151a942">Thread::parallel_transform()</a> taking a binary callable object, except that it returns a std::tuple object containing iterators to the element past the last elements of the source ranges transformed, and a destination iterator to the element past the last element stored in the destination range, and it has a 'max' parameter to limit the maximum number of elements which will be so transformed on any one call to this function. Whether this limitation has had effect on any one call can be tested by checking whether the first value of the tuple returned is equal to the 'last' parameter. If it is not, a further call to this function can be made.</p>
<p>The main purpose of this additional function is to enable the parallel transform of the elements of a container to be dealt with in chunks, possibly to enable other tasks to be interleaved at reasonable intervals. For source or destination containers which do not support random access iterators, the 'last' parameter can be set to, say, the end of the container and the chunk size set with the 'max' paramater, with the values of the returned tuple being used as the 'first1', 'first2' and 'dest' parameters for subsequent calls to this function. This avoids having to increment the source and destination iterators for each "chunk" by stepping through the respective containers by hand. In this usage, it therefore represents a minor efficiency improvement.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">tm</td><td>The <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object on which the tasks will run. </td></tr>
    <tr><td class="paramname">first1</td><td>The beginning of the range which is to be passed as the first argument of 'func'. </td></tr>
    <tr><td class="paramname">last1</td><td>One past the last element of the range which is to be passed as the first argument of 'func', subject to any maximum specified as the 'max' parameter. </td></tr>
    <tr><td class="paramname">first2</td><td>The beginning of the range which is to be passed as the second argument of 'func'. </td></tr>
    <tr><td class="paramname">dest</td><td>The beginning of the range to which the result of applying 'func' to the elements in the source ranges is to be stored. As in the case of std::transform, this can overlap with or be the same as one of the source ranges. It may also be an insert iterator. </td></tr>
    <tr><td class="paramname">max</td><td>The maximum number of elements of the source containers which will be transformed on this call. It is not an error if it is greater than the distance between 'first1' and 'last1'. If it is equal to or greater than that distance, it follows that the first value of the tuple returned by this function will be equal to 'last1'. The same results if 'max' is a negative number (in that case no maximum will take effect and all elements in the range ['first1', 'last1') will be transformed), so passing -1 might be useful as a means of obtaining a second source iterator (the second value of the tuple) or destination iterator (the third value) for other purposes, particularly where they are not random access iterators. </td></tr>
    <tr><td class="paramname">func</td><td>A binary callable object to be applied (subject to the maximum) to each element in the source ranges, such as formed by a lambda expression or the result of std::bind. It should take two unbound arguments of the value types of the containers to which 'first1' and 'first2' relate or const or non-const references to those types. If an exception propagates from 'func', the exception will be consumed while the transform loop is running, and an attempt will still be made to apply 'func' to all remaining elements of the source ranges subject to the maximum, and only after that attempt has completed will the exception <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> be thrown. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A std::tuple object. Its first value is an iterator representing the element past the last element of the first source range transformed, which may be passed as the 'first1' argument of a subsequent call to this function; its second value is an iterator representing the element past the last element of the second source range transformed, which may be passed as the 'first2' argument of the subsequent call; and its third value is an iterator representing the element past the last element stored in the destination range, which may be passed as the 'dest' argument of the subsequent call. </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::bad_alloc</td><td>This exception will be thrown if memory is exhausted and the system throws in that case. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion). If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function, but subsequent ones will not. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1TaskError.html">Cgu::Thread::TaskError</a></td><td>This exception will be thrown if stop_all() has previously been called on the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object, or if another thread calls stop_all() after this method is called but before it has returned. It will also be thrown if the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object's is_error() method would return true because its internal thread pool loop implementation has thrown std::bad_alloc, or a thread has failed to start correctly because pthread has run out of resources. (On systems with over-commit/lazy-commit combined with virtual memory (swap), it is rarely useful to check for memory exhaustion, and if a reasonable maximum thread count has been chosen for the <a class="el" href="classCgu_1_1Thread_1_1TaskManager.html" title="A thread-pool class for managing tasks in multi-threaded programs. ">Thread::TaskManager</a> object pthread should not run out of other resources, but there may be some specialized cases where the return value of is_error() is useful.) If this exception is thrown, some tasks may nonetheless have already started by virtue of the call to this function. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a></td><td>This exception will be thrown if an exception propagates from the 'func' callable object when it executes on being applied to one or more elements of the source ranges. Such an exception will not stop an attempt being made to apply 'func' (successfully or unsuccessfully) to all elements in the source ranges subject to the maximum. <a class="el" href="structCgu_1_1Thread_1_1ParallelError.html">Cgu::Thread::ParallelError</a> will be thrown after such attempted application has finished. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1MutexError.html">Cgu::Thread::MutexError</a></td><td>This exception will be thrown if initialization of a mutex used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new mutexes.) If this exception is thrown, no tasks will start. </td></tr>
    <tr><td class="paramname"><a class="el" href="structCgu_1_1Thread_1_1CondError.html">Cgu::Thread::CondError</a></td><td>This exception will be thrown if initialization of a condition variable used by this function fails. (It is often not worth checking for this, as it means either memory is exhausted or pthread has run out of other resources to create new condition variables.) If this exception is thrown, no tasks will start. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>An exception might also be thrown if the copy or move constructor of the 'func' callable objects throws. If such an exception is thrown, no tasks will start.</dd></dl>
<p>Since 2.0.20/2.2.3 </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Sep 16 2013 20:45:31 for c++-gtk-utils by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
</small></address>
</body>
</html>