KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/share/devhelp/books/dbus/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/share/devhelp/books/dbus/api/group__DBusThreads.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>D-Bus: Thread functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul></div>
<h1>Thread functions<br>
<small>
[<a class="el" href="group__DBus.html">D-Bus low-level public API</a>]</small>
</h1><a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> and <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a>  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Functions that must be implemented to make the D-Bus library thread-aware.  <a href="structDBusThreadFunctions.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g4eb021cd6cd0830423eac2738e0ddc40"></a><!-- doxytag: member="DBusThreads::DBusMutex" ref="g4eb021cd6cd0830423eac2738e0ddc40" args="" -->
typedef <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An opaque mutex type provided by the <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> implementation installed by <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga14cd16a336a85b5edbca3c237c3829e"></a><!-- doxytag: member="DBusThreads::DBusCondVar" ref="ga14cd16a336a85b5edbca3c237c3829e" args="" -->
typedef <a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An opaque condition variable type provided by the <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> implementation installed by <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gb3817e9dc0798e7a519df7ac5431ea25"></a><!-- doxytag: member="DBusThreads::DBusMutexNewFunction" ref="gb3817e9dc0798e7a519df7ac5431ea25" args="(void)" -->
typedef <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#gb3817e9dc0798e7a519df7ac5431ea25">DBusMutexNewFunction</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deprecated, provide DBusRecursiveMutexNewFunction instead. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g8c67a631ab136d96e34c44f9837dcfe9"></a><!-- doxytag: member="DBusThreads::DBusMutexFreeFunction" ref="g8c67a631ab136d96e34c44f9837dcfe9" args="(DBusMutex *mutex)" -->
typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g8c67a631ab136d96e34c44f9837dcfe9">DBusMutexFreeFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deprecated, provide DBusRecursiveMutexFreeFunction instead. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g0898fbcdb9ce075ad22a4ba62c764e55">DBusMutexLockFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deprecated, provide DBusRecursiveMutexLockFunction instead.  <a href="#g0898fbcdb9ce075ad22a4ba62c764e55"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g6af259fe33b3abbea037aa5845d52c31">DBusMutexUnlockFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deprecated, provide DBusRecursiveMutexUnlockFunction instead.  <a href="#g6af259fe33b3abbea037aa5845d52c31"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#gefea5db4419f173f3e712ef94e5720b4">DBusRecursiveMutexNewFunction</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new recursively-lockable mutex, or returns <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> if not enough memory.  <a href="#gefea5db4419f173f3e712ef94e5720b4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g1af3cc1f19d1ac9c5626384616f53c00">DBusRecursiveMutexFreeFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees a recursively-lockable mutex.  <a href="#g1af3cc1f19d1ac9c5626384616f53c00"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#gbe758099d0c00d678df2300ec2fff44f">DBusRecursiveMutexLockFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Locks a recursively-lockable mutex.  <a href="#gbe758099d0c00d678df2300ec2fff44f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g9aeb5599003075dd85eb88cbeac4d904">DBusRecursiveMutexUnlockFunction</a> (<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unlocks a recursively-lockable mutex.  <a href="#g9aeb5599003075dd85eb88cbeac4d904"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g3e2c4e12a9ff66463e67a44a35cbed3b">DBusCondVarNewFunction</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new condition variable.  <a href="#g3e2c4e12a9ff66463e67a44a35cbed3b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g37d922f1c48ac5cc99b8cf8491ed1d77">DBusCondVarFreeFunction</a> (<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Frees a condition variable.  <a href="#g37d922f1c48ac5cc99b8cf8491ed1d77"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g2c1781991e26d8576ee83ea6c0d6e7d2">DBusCondVarWaitFunction</a> (<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond, <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Waits on a condition variable.  <a href="#g2c1781991e26d8576ee83ea6c0d6e7d2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#ge121475a38fd6572bc30f2a707251bad">DBusCondVarWaitTimeoutFunction</a> (<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond, <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex, int timeout_milliseconds)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Waits on a condition variable with a timeout.  <a href="#ge121475a38fd6572bc30f2a707251bad"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#gfb6fc546a9df8424d5cf374f3927cd41">DBusCondVarWakeOneFunction</a> (<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wakes one waiting thread on a condition variable.  <a href="#gfb6fc546a9df8424d5cf374f3927cd41"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">typedef void(*)&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#g1e26a5fc7202d27452c1efd9b4abb835">DBusCondVarWakeAllFunction</a> (<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wakes all waiting threads on a condition variable.  <a href="#g1e26a5fc7202d27452c1efd9b4abb835"></a><br></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__DBusThreads.html#gf6212cb5e78b84cf5c6c6cb6e2b5aabe">DBusThreadFunctionsMask</a> { <br>
&nbsp;&nbsp;<b>DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK</b> =  1 &lt;&lt; 0, 
<b>DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK</b> =  1 &lt;&lt; 1, 
<b>DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK</b> =  1 &lt;&lt; 2, 
<b>DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK</b> =  1 &lt;&lt; 3, 
<br>
&nbsp;&nbsp;<b>DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK</b> =  1 &lt;&lt; 4, 
<b>DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK</b> =  1 &lt;&lt; 5, 
<b>DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK</b> =  1 &lt;&lt; 6, 
<b>DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK</b> =  1 &lt;&lt; 7, 
<br>
&nbsp;&nbsp;<b>DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK</b> =  1 &lt;&lt; 8, 
<b>DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK</b> =  1 &lt;&lt; 9, 
<b>DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK</b> =  1 &lt;&lt; 10, 
<b>DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK</b> =  1 &lt;&lt; 11, 
<br>
&nbsp;&nbsp;<b>DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK</b> =  1 &lt;&lt; 12, 
<b>DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK</b> =  1 &lt;&lt; 13, 
<b>DBUS_THREAD_FUNCTIONS_ALL_MASK</b> =  (1 &lt;&lt; 14) - 1
<br>
 }</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Flags indicating which functions are present in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>.  <a href="group__DBusThreads.html#gf6212cb5e78b84cf5c6c6cb6e2b5aabe">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init</a> (const <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> *functions)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initializes threads.  <a href="#ga9a4ed445c77af3afa0dbdbb9d85afd4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Calls <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> with a default set of <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> appropriate for the platform.  <a href="#gf508fbf3e39435491244b856183a1296"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> and <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a> 
<p>
Functions and macros related to threads and thread locks.<p>
If threads are initialized, the D-Bus library has locks on all global data structures. In addition, each <a class="el" href="structDBusConnection.html">DBusConnection</a> has a lock, so only one thread at a time can touch the connection. (See <a class="el" href="group__DBusConnection.html">DBusConnection</a> for more on connection locking.)<p>
Most other objects, however, do not have locks - they can only be used from a single thread at a time, unless you lock them yourself. For example, a <a class="el" href="structDBusMessage.html">DBusMessage</a> can't be modified from two threads at once. <hr><h2>Typedef Documentation</h2>
<a class="anchor" name="g37d922f1c48ac5cc99b8cf8491ed1d77"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarFreeFunction" ref="g37d922f1c48ac5cc99b8cf8491ed1d77" args="(DBusCondVar *cond)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#g37d922f1c48ac5cc99b8cf8491ed1d77">DBusCondVarFreeFunction</a>(<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Frees a condition variable. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00080">80</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g3e2c4e12a9ff66463e67a44a35cbed3b"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarNewFunction" ref="g3e2c4e12a9ff66463e67a44a35cbed3b" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a>*(* ) <a class="el" href="group__DBusThreads.html#g3e2c4e12a9ff66463e67a44a35cbed3b">DBusCondVarNewFunction</a>(void)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new condition variable. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Can only fail (returning <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>) due to lack of memory. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00077">77</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g2c1781991e26d8576ee83ea6c0d6e7d2"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarWaitFunction" ref="g2c1781991e26d8576ee83ea6c0d6e7d2" args="(DBusCondVar *cond, DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#g2c1781991e26d8576ee83ea6c0d6e7d2">DBusCondVarWaitFunction</a>(<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond, <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Waits on a condition variable. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Must work with either a recursive or nonrecursive mutex, whichever the thread implementation provides. Note that PTHREAD_MUTEX_RECURSIVE does not work with condition variables (does not save/restore the recursion count) so don't try using simply pthread_cond_wait() and a PTHREAD_MUTEX_RECURSIVE to implement this, it won't work right.<p>
Has no error conditions. Must succeed if it returns. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00092">92</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="ge121475a38fd6572bc30f2a707251bad"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarWaitTimeoutFunction" ref="ge121475a38fd6572bc30f2a707251bad" args="(DBusCondVar *cond, DBusMutex *mutex, int timeout_milliseconds)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(* ) <a class="el" href="group__DBusThreads.html#ge121475a38fd6572bc30f2a707251bad">DBusCondVarWaitTimeoutFunction</a>(<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond, <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex, int timeout_milliseconds)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Waits on a condition variable with a timeout. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Returns <a class="el" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a> if the wait did not time out, and <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a> if it did.<p>
Has no error conditions. Must succeed if it returns. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00101">101</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g1e26a5fc7202d27452c1efd9b4abb835"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarWakeAllFunction" ref="g1e26a5fc7202d27452c1efd9b4abb835" args="(DBusCondVar *cond)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#g1e26a5fc7202d27452c1efd9b4abb835">DBusCondVarWakeAllFunction</a>(<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wakes all waiting threads on a condition variable. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>.<p>
Has no error conditions. Must succeed if it returns. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00114">114</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="gfb6fc546a9df8424d5cf374f3927cd41"></a><!-- doxytag: member="dbus-threads.h::DBusCondVarWakeOneFunction" ref="gfb6fc546a9df8424d5cf374f3927cd41" args="(DBusCondVar *cond)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#gfb6fc546a9df8424d5cf374f3927cd41">DBusCondVarWakeOneFunction</a>(<a class="el" href="group__DBusThreads.html#ga14cd16a336a85b5edbca3c237c3829e">DBusCondVar</a> *cond)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wakes one waiting thread on a condition variable. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>.<p>
Has no error conditions. Must succeed if it returns. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00108">108</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g0898fbcdb9ce075ad22a4ba62c764e55"></a><!-- doxytag: member="dbus-threads.h::DBusMutexLockFunction" ref="g0898fbcdb9ce075ad22a4ba62c764e55" args="(DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(* ) <a class="el" href="group__DBusThreads.html#g0898fbcdb9ce075ad22a4ba62c764e55">DBusMutexLockFunction</a>(<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Deprecated, provide DBusRecursiveMutexLockFunction instead. 
<p>
Return value is lock success, but gets ignored in practice. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00050">50</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g6af259fe33b3abbea037aa5845d52c31"></a><!-- doxytag: member="dbus-threads.h::DBusMutexUnlockFunction" ref="g6af259fe33b3abbea037aa5845d52c31" args="(DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>(* ) <a class="el" href="group__DBusThreads.html#g6af259fe33b3abbea037aa5845d52c31">DBusMutexUnlockFunction</a>(<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Deprecated, provide DBusRecursiveMutexUnlockFunction instead. 
<p>
Return value is unlock success, but gets ignored in practice. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00052">52</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g1af3cc1f19d1ac9c5626384616f53c00"></a><!-- doxytag: member="dbus-threads.h::DBusRecursiveMutexFreeFunction" ref="g1af3cc1f19d1ac9c5626384616f53c00" args="(DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#g1af3cc1f19d1ac9c5626384616f53c00">DBusRecursiveMutexFreeFunction</a>(<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Frees a recursively-lockable mutex. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00064">64</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="gbe758099d0c00d678df2300ec2fff44f"></a><!-- doxytag: member="dbus-threads.h::DBusRecursiveMutexLockFunction" ref="gbe758099d0c00d678df2300ec2fff44f" args="(DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#gbe758099d0c00d678df2300ec2fff44f">DBusRecursiveMutexLockFunction</a>(<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Locks a recursively-lockable mutex. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Can only fail due to lack of memory. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00068">68</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="gefea5db4419f173f3e712ef94e5720b4"></a><!-- doxytag: member="dbus-threads.h::DBusRecursiveMutexNewFunction" ref="gefea5db4419f173f3e712ef94e5720b4" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a>*(* ) <a class="el" href="group__DBusThreads.html#gefea5db4419f173f3e712ef94e5720b4">DBusRecursiveMutexNewFunction</a>(void)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a new recursively-lockable mutex, or returns <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> if not enough memory. 
<p>
Can only fail due to lack of memory. Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Do not just use PTHREAD_MUTEX_RECURSIVE for this, because it does not save/restore the recursion count when waiting on a condition. libdbus requires the Java-style behavior where the mutex is fully unlocked to wait on a condition. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00061">61</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<a class="anchor" name="g9aeb5599003075dd85eb88cbeac4d904"></a><!-- doxytag: member="dbus-threads.h::DBusRecursiveMutexUnlockFunction" ref="g9aeb5599003075dd85eb88cbeac4d904" args="(DBusMutex *mutex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(* ) <a class="el" href="group__DBusThreads.html#g9aeb5599003075dd85eb88cbeac4d904">DBusRecursiveMutexUnlockFunction</a>(<a class="el" href="group__DBusThreads.html#g4eb021cd6cd0830423eac2738e0ddc40">DBusMutex</a> *mutex)          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unlocks a recursively-lockable mutex. 
<p>
Found in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. Can only fail due to lack of memory. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00072">72</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<hr><h2>Enumeration Type Documentation</h2>
<a class="anchor" name="gf6212cb5e78b84cf5c6c6cb6e2b5aabe"></a><!-- doxytag: member="dbus-threads.h::DBusThreadFunctionsMask" ref="gf6212cb5e78b84cf5c6c6cb6e2b5aabe" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__DBusThreads.html#gf6212cb5e78b84cf5c6c6cb6e2b5aabe">DBusThreadFunctionsMask</a>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Flags indicating which functions are present in <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. 
<p>
Used to allow the library to detect older callers of <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> if new possible functions are added to <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a>. 
<p>
Definition at line <a class="el" href="dbus-threads_8h-source.html#l00121">121</a> of file <a class="el" href="dbus-threads_8h-source.html">dbus-threads.h</a>.
</div>
</div><p>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga9a4ed445c77af3afa0dbdbb9d85afd4"></a><!-- doxytag: member="dbus-threads.c::dbus_threads_init" ref="ga9a4ed445c77af3afa0dbdbb9d85afd4" args="(const DBusThreadFunctions *functions)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> dbus_threads_init           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> *&nbsp;</td>
          <td class="paramname"> <em>functions</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initializes threads. 
<p>
If this function is not called, the D-Bus library will not lock any data structures. If it is called, D-Bus will do locking, at some cost in efficiency. Note that this function must be called BEFORE the second thread is started.<p>
Almost always, you should use <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a> instead. The raw <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> is only useful if you require a particular thread implementation for some reason.<p>
A possible reason to use <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> rather than <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a> is to insert debugging checks or print statements.<p>
<a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> may be called more than once. The first one wins and subsequent calls are ignored. (Unless you use <a class="el" href="group__DBusMemory.html#g8b177950791eebaefc7dc1e836c0964c">dbus_shutdown()</a> to reset libdbus, which will let you re-init threads.)<p>
Either recursive or nonrecursive mutex functions must be specified, but not both. New code should provide only the recursive functions<ul>
<li>specifying the nonrecursive ones is deprecated.</li></ul>
<p>
Because this function effectively sets global state, all code running in a given application must agree on the thread implementation. Most code won't care which thread implementation is used, so there's no problem. However, usually libraries should not call <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> or <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a>, instead leaving this policy choice to applications.<p>
The exception is for application frameworks (GLib, Qt, etc.) and D-Bus bindings based on application frameworks. These frameworks define a cross-platform thread abstraction and can assume applications using the framework are OK with using that thread abstraction.<p>
However, even these app frameworks may find it easier to simply call <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a>, and there's no reason they shouldn't.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>functions</em>&nbsp;</td><td>functions for using threads </td></tr>
  </table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a> on success, <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a> if no memory </dd></dl>

<p>
Definition at line <a class="el" href="dbus-threads_8c-source.html#l00545">545</a> of file <a class="el" href="dbus-threads_8c-source.html">dbus-threads.c</a>.
<p>
References <a class="el" href="dbus-internals_8h-source.html#l00109">_dbus_assert</a>, <a class="el" href="dbus-internals_8h-source.html#l00121">_dbus_assert_not_reached</a>, <a class="el" href="dbus-memory_8c-source.html#l00687">_dbus_current_generation</a>, <a class="el" href="dbus-threads_8h-source.html#l00171">DBusThreadFunctions::condvar_free</a>, <a class="el" href="dbus-threads_8h-source.html#l00170">DBusThreadFunctions::condvar_new</a>, <a class="el" href="dbus-threads_8h-source.html#l00172">DBusThreadFunctions::condvar_wait</a>, <a class="el" href="dbus-threads_8h-source.html#l00173">DBusThreadFunctions::condvar_wait_timeout</a>, <a class="el" href="dbus-threads_8h-source.html#l00175">DBusThreadFunctions::condvar_wake_all</a>, <a class="el" href="dbus-threads_8h-source.html#l00174">DBusThreadFunctions::condvar_wake_one</a>, <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>, <a class="el" href="dbus-threads_8h-source.html#l00163">DBusThreadFunctions::mask</a>, <a class="el" href="dbus-threads_8h-source.html#l00166">DBusThreadFunctions::mutex_free</a>, <a class="el" href="dbus-threads_8h-source.html#l00167">DBusThreadFunctions::mutex_lock</a>, <a class="el" href="dbus-threads_8h-source.html#l00165">DBusThreadFunctions::mutex_new</a>, <a class="el" href="dbus-threads_8h-source.html#l00168">DBusThreadFunctions::mutex_unlock</a>, <a class="el" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="el" href="dbus-threads_8h-source.html#l00178">DBusThreadFunctions::recursive_mutex_free</a>, <a class="el" href="dbus-threads_8h-source.html#l00179">DBusThreadFunctions::recursive_mutex_lock</a>, <a class="el" href="dbus-threads_8h-source.html#l00177">DBusThreadFunctions::recursive_mutex_new</a>, <a class="el" href="dbus-threads_8h-source.html#l00180">DBusThreadFunctions::recursive_mutex_unlock</a>, and <a class="el" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>.
<p>
Referenced by <a class="el" href="dbus-sysdeps-pthread_8c-source.html#l00321">_dbus_threads_init_platform_specific()</a>.
</div>
</div><p>
<a class="anchor" name="gf508fbf3e39435491244b856183a1296"></a><!-- doxytag: member="dbus-threads.c::dbus_threads_init_default" ref="gf508fbf3e39435491244b856183a1296" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a> dbus_threads_init_default           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Calls <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a> with a default set of <a class="el" href="structDBusThreadFunctions.html">DBusThreadFunctions</a> appropriate for the platform. 
<p>
Most applications should use this rather than <a class="el" href="group__DBusThreads.html#ga9a4ed445c77af3afa0dbdbb9d85afd4">dbus_threads_init()</a>.<p>
It's safe to call <a class="el" href="group__DBusThreads.html#gf508fbf3e39435491244b856183a1296">dbus_threads_init_default()</a> as many times as you want, but only the first time will have an effect.<p>
<a class="el" href="group__DBusMemory.html#g8b177950791eebaefc7dc1e836c0964c">dbus_shutdown()</a> reverses the effects of this function when it resets all global state in libdbus.<p>
<dl compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a> on success, <a class="el" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a> if not enough memory </dd></dl>

<p>
Definition at line <a class="el" href="dbus-threads_8c-source.html#l00671">671</a> of file <a class="el" href="dbus-threads_8c-source.html">dbus-threads.c</a>.
<p>
References <a class="el" href="dbus-sysdeps-pthread_8c-source.html#l00321">_dbus_threads_init_platform_specific()</a>.
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Mon Dec 14 22:26:15 2009 for D-Bus by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

Anon7 - 2021