Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > e8cbfa9673da18966abee0a6d7051b87 > files > 1424

glibmm2.4-doc-2.16.1-1mdv2008.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>glibmm 2.4: thread/dispatcher.cc</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<table border="0" width="100%">
<tr>
    <td width="10%" height="40"><img src="../../images/gtkmm_logo.gif" alt="logo" border="0" width="100%" height="100%"/></td>
    <td width="90%" height="40"><img src="../../images/top.gif" alt="top" width="100%" height="40"/></td>
</tr>
</table>
<center>
  <a class="qindex" href="../../../../gtkmm-2.4/docs/index.html">Main Page</a> &nbsp;
  <a href="../../../../gtkmm-2.4/docs/reference/html/group__Widgets.html">Widgets</a> &nbsp;
  <a class="qindex" href="namespaces.html">glibmm Namespaces</a> &nbsp;
  <a href="../../../../gtkmm-2.4/docs/tutorial/html/index.html"> Book</a> &nbsp;
</center>
<hr width="100%"/>

<!-- begin main content -->
<div id="content">
<!-- Generated by Doxygen 1.5.3 -->
<h1>thread/dispatcher.cc</h1>A <a class="el" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication.">Glib::Dispatcher</a> example.<p>
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Glib::Dispatcher example -- cross thread signalling</span>
<a name="l00003"></a>00003 <span class="comment"> * by Daniel Elstner  &lt;daniel.kitta@gmail.com&gt;</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * modified to only use glibmm</span>
<a name="l00006"></a>00006 <span class="comment"> * by J. Abelardo Gutierrez &lt;jabelardo@cantv.net&gt;</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * Copyright (c) 2002-2003  Free Software Foundation</span>
<a name="l00009"></a>00009 <span class="comment"> */</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;glibmm.h&gt;</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/algorithm.html">algorithm</a>&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/functional.html">functional</a>&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/iostream.html">iostream</a>&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/vector.html">vector</a>&gt;</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="keyword">namespace</span>
<a name="l00019"></a>00019 {
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">/*</span>
<a name="l00022"></a>00022 <span class="comment"> * Note that it does not make sense for this class to inherit from</span>
<a name="l00023"></a>00023 <span class="comment"> * sigc::trackable, as doing so would only give a false sense of security.</span>
<a name="l00024"></a>00024 <span class="comment"> * Once the thread launch has been triggered, the object has to stay alive</span>
<a name="l00025"></a>00025 <span class="comment"> * until the thread has been joined again.  The code running in the thread</span>
<a name="l00026"></a>00026 <span class="comment"> * assumes the existence of the object.  If it is destroyed earlier, the</span>
<a name="l00027"></a>00027 <span class="comment"> * program will crash, with sigc::trackable or without it.</span>
<a name="l00028"></a>00028 <span class="comment"> */</span>
<a name="l00029"></a>00029 <span class="keyword">class </span>ThreadProgress
<a name="l00030"></a>00030 {
<a name="l00031"></a>00031 <span class="keyword">public</span>:
<a name="l00032"></a>00032   <span class="keyword">explicit</span> ThreadProgress(<span class="keywordtype">int</span> <span class="keywordtype">id</span>);
<a name="l00033"></a>00033   <span class="keyword">virtual</span> ~ThreadProgress();
<a name="l00034"></a>00034 
<a name="l00035"></a>00035   <span class="keywordtype">int</span>  id() <span class="keyword">const</span>;
<a name="l00036"></a>00036   <span class="keywordtype">void</span> launch();
<a name="l00037"></a>00037   <span class="keywordtype">void</span> join();
<a name="l00038"></a>00038   <span class="keywordtype">bool</span> unfinished() <span class="keyword">const</span>;
<a name="l00039"></a>00039 
<a name="l00040"></a>00040   sigc::signal&lt;void&gt;&amp; signal_finished();
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="keyword">private</span>:
<a name="l00043"></a>00043   <span class="keyword">enum</span> { ITERATIONS = 100 };
<a name="l00044"></a>00044 
<a name="l00045"></a>00045   <span class="comment">// Note that the thread does not write to the member data at all.  It only</span>
<a name="l00046"></a>00046   <span class="comment">// reads signal_increment_, which is only written to before the thread is</span>
<a name="l00047"></a>00047   <span class="comment">// lauched.  Therefore, no locking is required.</span>
<a name="l00048"></a>00048   <a name="_a0"></a><a class="code" href="classGlib_1_1Thread.html" title="Represents a running thread.">Glib::Thread</a>*       thread_;
<a name="l00049"></a>00049   <span class="keywordtype">int</span>                 id_;
<a name="l00050"></a>00050   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>        progress_;
<a name="l00051"></a>00051   <a name="_a1"></a><a class="code" href="classGlib_1_1Dispatcher.html" title="Signal class for inter-thread communication.">Glib::Dispatcher</a>    signal_increment_;
<a name="l00052"></a>00052   sigc::signal&lt;void&gt;  signal_finished_;
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <span class="keywordtype">void</span> progress_increment();
<a name="l00055"></a>00055   <span class="keywordtype">void</span> thread_function();
<a name="l00056"></a>00056 };
<a name="l00057"></a>00057 
<a name="l00058"></a>00058 <span class="keyword">class </span>Application : <span class="keyword">public</span> sigc::<a name="_a2"></a><a class="code" href="classsigc_1_1trackable.html">trackable</a>
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 <span class="keyword">public</span>:
<a name="l00061"></a>00061   Application();
<a name="l00062"></a>00062   <span class="keyword">virtual</span> ~Application();
<a name="l00063"></a>00063 
<a name="l00064"></a>00064   <span class="keywordtype">void</span> run();
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="keyword">private</span>:
<a name="l00067"></a>00067   <a name="_a3"></a><a class="code" href="classGlib_1_1RefPtr.html" title="RefPtr&amp;lt;&amp;gt; is a reference-counting shared smartpointer.">Glib::RefPtr&lt;Glib::MainLoop&gt;</a>  main_loop_;
<a name="l00068"></a>00068   <a name="_a4"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1vector.html">std::vector&lt;ThreadProgress*&gt;</a>  progress_threads_;
<a name="l00069"></a>00069 
<a name="l00070"></a>00070   <span class="keywordtype">void</span> launch_threads();
<a name="l00071"></a>00071   <span class="keywordtype">void</span> on_progress_finished(ThreadProgress* thread_progress);
<a name="l00072"></a>00072 };
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00075"></a>00075 <span class="keyword">class </span>DeletePtr : <span class="keyword">public</span> std::unary_function&lt;void, T&gt;
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 <span class="keyword">public</span>:
<a name="l00078"></a>00078   <span class="keywordtype">void</span> <a class="code" href="bind__iterate_8h.html#a0">operator()</a>(T ptr)<span class="keyword"> const </span>{ <span class="keyword">delete</span> ptr; }
<a name="l00079"></a>00079 };
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 ThreadProgress::ThreadProgress(<span class="keywordtype">int</span> <span class="keywordtype">id</span>)
<a name="l00082"></a>00082 :
<a name="l00083"></a>00083   thread_   (0),
<a name="l00084"></a>00084   id_       (<span class="keywordtype">id</span>),
<a name="l00085"></a>00085   progress_ (0)
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087   <span class="comment">// Connect to the cross-thread signal.</span>
<a name="l00088"></a>00088   signal_increment_.connect(<a name="a5"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#gga2">sigc::mem_fun</a>(*<span class="keyword">this</span>, &amp;ThreadProgress::progress_increment));
<a name="l00089"></a>00089 }
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 ThreadProgress::~ThreadProgress()
<a name="l00092"></a>00092 {
<a name="l00093"></a>00093   <span class="comment">// It is an error if the thread is still running at this point.</span>
<a name="l00094"></a>00094   g_return_if_fail(thread_ == 0);
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keywordtype">int</span> ThreadProgress::id()<span class="keyword"> const</span>
<a name="l00098"></a>00098 <span class="keyword"></span>{
<a name="l00099"></a>00099   <span class="keywordflow">return</span> id_;
<a name="l00100"></a>00100 }
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 <span class="keywordtype">void</span> ThreadProgress::launch()
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104   <span class="comment">// Create a joinable thread.</span>
<a name="l00105"></a>00105   thread_ = <a name="a6"></a><a class="code" href="classGlib_1_1Thread.html#b165854ff2fc9b454ee4d97050485782" title="Creates a new thread with the priority THREAD_PRIORITY_NORMAL.">Glib::Thread::create</a>(<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#gga2">sigc::mem_fun</a>(*<span class="keyword">this</span>, &amp;ThreadProgress::thread_function), <span class="keyword">true</span>);
<a name="l00106"></a>00106 }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="keywordtype">void</span> ThreadProgress::join()
<a name="l00109"></a>00109 {
<a name="l00110"></a>00110   thread_-&gt;join();
<a name="l00111"></a>00111   thread_ = 0;
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="keywordtype">bool</span> ThreadProgress::unfinished()<span class="keyword"> const</span>
<a name="l00115"></a>00115 <span class="keyword"></span>{
<a name="l00116"></a>00116   <span class="keywordflow">return</span> (progress_ &lt; ITERATIONS);
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 sigc::signal&lt;void&gt;&amp; ThreadProgress::signal_finished()
<a name="l00120"></a>00120 {
<a name="l00121"></a>00121   <span class="keywordflow">return</span> signal_finished_;
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 
<a name="l00124"></a>00124 <span class="keywordtype">void</span> ThreadProgress::progress_increment()
<a name="l00125"></a>00125 {
<a name="l00126"></a>00126   ++progress_;
<a name="l00127"></a>00127   <a name="a7"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a81">std::cout</a> &lt;&lt; <span class="stringliteral">"Thread "</span> &lt;&lt; id_ &lt;&lt; <span class="stringliteral">": "</span> &lt;&lt; progress_ &lt;&lt; <span class="charliteral">'%'</span> &lt;&lt; <a name="a8"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a688">std::endl</a>;
<a name="l00128"></a>00128 
<a name="l00129"></a>00129   <span class="keywordflow">if</span> (progress_ &gt;= ITERATIONS)
<a name="l00130"></a>00130     signal_finished_();
<a name="l00131"></a>00131 }
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 <span class="keywordtype">void</span> ThreadProgress::thread_function()
<a name="l00134"></a>00134 {
<a name="l00135"></a>00135   <a name="_a9"></a><a class="code" href="classGlib_1_1Rand.html">Glib::Rand</a> rand;
<a name="l00136"></a>00136 
<a name="l00137"></a>00137   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; ITERATIONS; ++i)
<a name="l00138"></a>00138   {
<a name="l00139"></a>00139     <a name="a10"></a><a class="code" href="namespaceGlib.html#5d75264c8b47f13fb33f973b0d4fc73e">Glib::usleep</a>(rand.<a name="a11"></a><a class="code" href="classGlib_1_1Rand.html#182b9a36db153d316baf5efb1ece9fd7">get_int_range</a>(2000, 20000));
<a name="l00140"></a>00140 
<a name="l00141"></a>00141     <span class="comment">// Tell the main thread to increment the progress value.</span>
<a name="l00142"></a>00142     signal_increment_();
<a name="l00143"></a>00143   }
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 Application::Application()
<a name="l00147"></a>00147 :
<a name="l00148"></a>00148   main_loop_        (<a name="a12"></a><a class="code" href="classGlib_1_1MainLoop.html#37a1dcf3cb167cf02260111f533d0b5b">Glib::MainLoop::create</a>()),
<a name="l00149"></a>00149   progress_threads_ (5)
<a name="l00150"></a>00150 {
<a name="l00151"></a>00151   <span class="comment">// Note that unless you're targetting an embedded platform, you can assume</span>
<a name="l00152"></a>00152   <span class="comment">// exceptions to be enabled.  The #ifdef is only here to make the example</span>
<a name="l00153"></a>00153   <span class="comment">// compile in either case; you may ignore it otherwise.</span>
<a name="l00154"></a>00154 <span class="preprocessor">#ifdef GLIBMM_EXCEPTIONS_ENABLED</span>
<a name="l00155"></a>00155 <span class="preprocessor"></span>  <span class="keywordflow">try</span>
<a name="l00156"></a>00156 <span class="preprocessor">#endif</span>
<a name="l00157"></a>00157 <span class="preprocessor"></span>  {
<a name="l00158"></a>00158     <span class="keywordflow">for</span> (<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/classstd_1_1vector.html">std::vector&lt;ThreadProgress*&gt;::size_type</a> i = 0; i &lt; progress_threads_.size(); ++i)
<a name="l00159"></a>00159     {
<a name="l00160"></a>00160       ThreadProgress *<span class="keyword">const</span> progress = <span class="keyword">new</span> ThreadProgress(i + 1);
<a name="l00161"></a>00161       progress_threads_[i] = progress;
<a name="l00162"></a>00162 
<a name="l00163"></a>00163       progress-&gt;signal_finished().connect(
<a name="l00164"></a>00164           sigc::bind&lt;1&gt;(<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#gga2">sigc::mem_fun</a>(*<span class="keyword">this</span>, &amp;Application::on_progress_finished), progress));
<a name="l00165"></a>00165     }
<a name="l00166"></a>00166   }
<a name="l00167"></a>00167 <span class="preprocessor">#ifdef GLIBMM_EXCEPTIONS_ENABLED</span>
<a name="l00168"></a>00168 <span class="preprocessor"></span>  <span class="keywordflow">catch</span> (...)
<a name="l00169"></a>00169   {
<a name="l00170"></a>00170     <span class="comment">// In your own code, you should preferably use a smart pointer</span>
<a name="l00171"></a>00171     <span class="comment">// to ensure exception safety.</span>
<a name="l00172"></a>00172     <a name="a13"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a232">std::for_each</a>(progress_threads_.begin(), progress_threads_.end(),
<a name="l00173"></a>00173                   DeletePtr&lt;ThreadProgress*&gt;());
<a name="l00174"></a>00174     <span class="keywordflow">throw</span>;
<a name="l00175"></a>00175   }
<a name="l00176"></a>00176 <span class="preprocessor">#endif</span>
<a name="l00177"></a>00177 <span class="preprocessor"></span>}
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 Application::~Application()
<a name="l00180"></a>00180 {
<a name="l00181"></a>00181   <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a232">std::for_each</a>(progress_threads_.begin(), progress_threads_.end(),
<a name="l00182"></a>00182                 DeletePtr&lt;ThreadProgress*&gt;());
<a name="l00183"></a>00183 }
<a name="l00184"></a>00184 
<a name="l00185"></a>00185 <span class="keywordtype">void</span> Application::run()
<a name="l00186"></a>00186 {
<a name="l00187"></a>00187   <span class="comment">// Install a one-shot idle handler to launch the threads.</span>
<a name="l00188"></a>00188   <a name="a14"></a><a class="code" href="group__MainLoop.html#g76792522d9680a05e232d3519a25f98d" title="Convenience idle signal.">Glib::signal_idle</a>().connect(
<a name="l00189"></a>00189       sigc::bind_return(<a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#gga2">sigc::mem_fun</a>(*<span class="keyword">this</span>, &amp;Application::launch_threads), <span class="keyword">false</span>));
<a name="l00190"></a>00190 
<a name="l00191"></a>00191   main_loop_-&gt;run();
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 
<a name="l00194"></a>00194 <span class="keywordtype">void</span> Application::launch_threads()
<a name="l00195"></a>00195 {
<a name="l00196"></a>00196   <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a81">std::cout</a> &lt;&lt; <span class="stringliteral">"Launching "</span> &lt;&lt; progress_threads_.size() &lt;&lt; <span class="stringliteral">" threads:"</span> &lt;&lt; <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a688">std::endl</a>;
<a name="l00197"></a>00197 
<a name="l00198"></a>00198   <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a232">std::for_each</a>(progress_threads_.begin(), progress_threads_.end(),
<a name="l00199"></a>00199                 <a name="a15"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#ga2">std::mem_fun</a>(&amp;ThreadProgress::launch));
<a name="l00200"></a>00200 }
<a name="l00201"></a>00201 
<a name="l00202"></a>00202 <span class="keywordtype">void</span> Application::on_progress_finished(ThreadProgress* thread_progress)
<a name="l00203"></a>00203 {
<a name="l00204"></a>00204   thread_progress-&gt;join();
<a name="l00205"></a>00205 
<a name="l00206"></a>00206   <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a81">std::cout</a> &lt;&lt; <span class="stringliteral">"Thread "</span> &lt;&lt; thread_progress-&gt;id() &lt;&lt; <span class="stringliteral">": finished."</span> &lt;&lt; <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a688">std::endl</a>;
<a name="l00207"></a>00207 
<a name="l00208"></a>00208   <span class="comment">// Quit if it was the last thread to be joined.</span>
<a name="l00209"></a>00209   <span class="keywordflow">if</span> (<a name="a16"></a><a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespacestd.html#a238">std::find_if</a>(progress_threads_.begin(), progress_threads_.end(),
<a name="l00210"></a>00210                    <a class="codeRef" doxygen="libstdc++.tag.xml:http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/" href="http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/group__s20__3__8__memadaptors.html#ga2">std::mem_fun</a>(&amp;ThreadProgress::unfinished)) == progress_threads_.end())
<a name="l00211"></a>00211   {
<a name="l00212"></a>00212     main_loop_-&gt;quit();
<a name="l00213"></a>00213   }
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215 
<a name="l00216"></a>00216 } <span class="comment">// anonymous namespace</span>
<a name="l00217"></a>00217 
<a name="l00218"></a>00218 <span class="keywordtype">int</span> main(<span class="keywordtype">int</span>, <span class="keywordtype">char</span>**)
<a name="l00219"></a>00219 {
<a name="l00220"></a>00220   <a name="a17"></a><a class="code" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">Glib::thread_init</a>();
<a name="l00221"></a>00221 
<a name="l00222"></a>00222   Application application;
<a name="l00223"></a>00223   application.run();
<a name="l00224"></a>00224 
<a name="l00225"></a>00225   <span class="keywordflow">return</span> 0;
<a name="l00226"></a>00226 }
</pre></div> </div> <!-- end main content -->

<hr><address><small>
Generated for glibmm 2.4 by <a href="http://www.doxygen.org/index.html">
Doxygen</a> 1.5.3 &copy;&nbsp;1997-2001</small></address>
</body>
</html>