Sophie

Sophie

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

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: Threads</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>Threads</h1><a class="el" href="classGlib_1_1Thread.html" title="Represents a running thread.">Thread</a> abstraction; including threads, different mutexes, conditions and thread private data.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Dispatcher.html">Glib::Dispatcher</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signal class for inter-thread communication.  <a href="classGlib_1_1Dispatcher.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1ThreadError.html">Glib::ThreadError</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="classGlib_1_1Exception.html">Exception</a> class for thread-related errors.  <a href="classGlib_1_1ThreadError.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread.html">Glib::Thread</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Represents a running thread.  <a href="classGlib_1_1Thread.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Thread_1_1Exit.html">Glib::Thread::Exit</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Exception class used to exit from a thread.  <a href="classGlib_1_1Thread_1_1Exit.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structGlib_1_1StaticMutex.html">Glib::StaticMutex</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Like <a class="el" href="classGlib_1_1Mutex.html" title="Represents a mutex (mutual exclusion).">Glib::Mutex</a>, but can be defined at compile time.  <a href="structGlib_1_1StaticMutex.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Mutex.html">Glib::Mutex</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Represents a mutex (mutual exclusion).  <a href="classGlib_1_1Mutex.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Mutex_1_1Lock.html">Glib::Mutex::Lock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility class for exception-safe mutex locking.  <a href="classGlib_1_1Mutex_1_1Lock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structGlib_1_1StaticRecMutex.html">Glib::StaticRecMutex</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Like <a class="el" href="classGlib_1_1RecMutex.html">Glib::RecMutex</a>, but can be defined at compile time.  <a href="structGlib_1_1StaticRecMutex.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1RecMutex.html">Glib::RecMutex</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1RecMutex_1_1Lock.html">Glib::RecMutex::Lock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility class for exception-safe locking of recursive mutexes.  <a href="classGlib_1_1RecMutex_1_1Lock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structGlib_1_1StaticRWLock.html">Glib::StaticRWLock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Like <a class="el" href="classGlib_1_1RWLock.html">Glib::RWLock</a>, but can be defined at compile time.  <a href="structGlib_1_1StaticRWLock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1RWLock.html">Glib::RWLock</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1RWLock_1_1ReaderLock.html">Glib::RWLock::ReaderLock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility class for exception-safe locking of read/write locks.  <a href="classGlib_1_1RWLock_1_1ReaderLock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1RWLock_1_1WriterLock.html">Glib::RWLock::WriterLock</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility class for exception-safe locking of read/write locks.  <a href="classGlib_1_1RWLock_1_1WriterLock.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Cond.html">Glib::Cond</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An opaque data structure to represent a condition.  <a href="classGlib_1_1Cond.html#_details">More...</a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structGlib_1_1StaticPrivate.html">Glib::StaticPrivate&lt;T&gt;</a></td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGlib_1_1Private.html">Glib::Private&lt;T&gt;</a></td></tr>

<tr><td colspan="2"><br><h2>Enumerations</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g2dd111336e3b057b51ca5871795fffa4">Glib::NotLock</a> { <a class="el" href="group__Threads.html#gg2dd111336e3b057b51ca5871795fffa49681fb4e85e62ba64e39a12526eaa840">Glib::NOT_LOCK</a>
 }</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g7441a36336ea4cdb35c0fddbf3f97b19">Glib::TryLock</a> { <a class="el" href="group__Threads.html#gg7441a36336ea4cdb35c0fddbf3f97b19df6b2565785992ff637cbc453988841d">Glib::TRY_LOCK</a>
 }</td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7">Glib::thread_init</a> (GThreadFunctions* vtable=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initializes the GLib thread system.  <a href="#gb26d01c776801f1fff00753e97af4fc7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#gd59d126f6197035e6f6a31e7f4d87818">Glib::thread_supported</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns whether the thread system is initialized.  <a href="#gd59d126f6197035e6f6a31e7f4d87818"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">Thread*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__Threads.html#g6bfbb3119eaac9fa8cb725aa1e82f61e">Glib::Thread::wrap</a> (GThread* gobject)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="classGlib_1_1Thread.html" title="Represents a running thread.">Thread</a> abstraction; including threads, different mutexes, conditions and thread private data. 
<p>
<hr><h2>Enumeration Type Documentation</h2>
<a class="anchor" name="g2dd111336e3b057b51ca5871795fffa4"></a><!-- doxytag: member="Glib::NotLock" ref="g2dd111336e3b057b51ca5871795fffa4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__Threads.html#g2dd111336e3b057b51ca5871795fffa4">Glib::NotLock</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="gg2dd111336e3b057b51ca5871795fffa49681fb4e85e62ba64e39a12526eaa840"></a><!-- doxytag: member="NOT_LOCK" ref="gg2dd111336e3b057b51ca5871795fffa49681fb4e85e62ba64e39a12526eaa840" args="" -->NOT_LOCK</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>

</div>
</div><p>
<a class="anchor" name="g7441a36336ea4cdb35c0fddbf3f97b19"></a><!-- doxytag: member="Glib::TryLock" ref="g7441a36336ea4cdb35c0fddbf3f97b19" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__Threads.html#g7441a36336ea4cdb35c0fddbf3f97b19">Glib::TryLock</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="gg7441a36336ea4cdb35c0fddbf3f97b19df6b2565785992ff637cbc453988841d"></a><!-- doxytag: member="TRY_LOCK" ref="gg7441a36336ea4cdb35c0fddbf3f97b19df6b2565785992ff637cbc453988841d" args="" -->TRY_LOCK</em>&nbsp;</td><td>
</td></tr>
</table>
</dl>

</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="gb26d01c776801f1fff00753e97af4fc7"></a><!-- doxytag: member="Glib::thread_init" ref="gb26d01c776801f1fff00753e97af4fc7" args="(GThreadFunctions *vtable=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Glib::thread_init           </td>
          <td>(</td>
          <td class="paramtype">GThreadFunctions *&nbsp;</td>
          <td class="paramname"> <em>vtable</em> = <code>0</code>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initializes the GLib thread system. 
<p>
Before you use a thread related function in glibmm, you should initialize the thread system. This is done by calling <a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">Glib::thread_init()</a>.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>You should only call <a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a> with a non-<code>0</code> parameter if you really know what you are doing.<p>
<a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a> must not be called directly or indirectly as a callback from glibmm. Also no mutexes may be currently locked while calling <a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a>.</dd></dl>
<a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a> might only be called once. On the second call it will abort with an error. If you want to make sure that the thread system is initialized, you can do that too: <div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span>(!<a class="code" href="group__Threads.html#gd59d126f6197035e6f6a31e7f4d87818" title="Returns whether the thread system is initialized.">Glib::thread_supported</a>()) <a class="code" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">Glib::thread_init</a>();
</pre></div> After that line either the thread system is initialized, or the program will abort if no thread system is available in GLib, i.e. either <code>G_THREADS_ENABLED</code> is not defined or <code>G_THREADS_IMPL_NONE</code> is defined.<p>
If no thread system is available and <em>vtable</em> is <code>0</code> or if not all elements of <em>vtable</em> are non-<code>0</code>, then <a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a> will abort.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>To use <a class="el" href="group__Threads.html#gb26d01c776801f1fff00753e97af4fc7" title="Initializes the GLib thread system.">thread_init()</a> in your program, you have to link with the libraries that the command <code>pkg-config&nbsp;--libs&nbsp;gthread-2.0</code> outputs. This is not the case for all the other thread related functions of glibmm. Those can be used without having to link with the thread libraries. (You <em>have</em> to link with <code>gthread-2.0</code> if you actually want to use threads in your application, though.)</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>vtable</em>&nbsp;</td><td>A function table of type <code>GThreadFunctions</code>, that provides the entry points to the thread system to be used. </td></tr>
  </table>
</dl>
<dl compact><dt><b>Examples: </b></dt><dd>
<a class="el" href="thread_2dispatcher_8cc-example.html#a17">thread/dispatcher.cc</a>, and <a class="el" href="thread_2thread_8cc-example.html#a10">thread/thread.cc</a>.</dl>
</div>
</div><p>
<a class="anchor" name="gd59d126f6197035e6f6a31e7f4d87818"></a><!-- doxytag: member="Glib::thread_supported" ref="gd59d126f6197035e6f6a31e7f4d87818" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Glib::thread_supported           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns whether the thread system is initialized. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd><code>true</code>, if the thread system is initialized. </dd></dl>

</div>
</div><p>
<a class="anchor" name="g6bfbb3119eaac9fa8cb725aa1e82f61e"></a><!-- doxytag: member="Glib::Thread::wrap" ref="g6bfbb3119eaac9fa8cb725aa1e82f61e" args="(GThread *gobject)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Thread * wrap           </td>
          <td>(</td>
          <td class="paramtype">GThread *&nbsp;</td>
          <td class="paramname"> <em>gobject</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [related, inherited]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
</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>