<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <!-- THIS FILE IS AUTOMATICALLY GENERATED FROM THE GLOBUS SOURCE CODE DO NOT MODIFY. --> <title>Globus Reference Manual</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.7.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> </ul> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('group__globus__mutex.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Mutual Exclusion</div> </div> <div class="ingroups"><a class="el" href="group__globus__thread.html">Threading</a></div></div> <div class="contents"> <div class="dynheader"> Collaboration diagram for Mutual Exclusion:</div> <div class="dyncontent"> <center><table><tr><td><img src="group__globus__mutex.png" border="0" alt="" usemap="#group____globus____mutex"/> <map name="group____globus____mutex" id="group____globus____mutex"> <area shape="rect" id="node1" href="group__globus__thread.html" title="The Globus runtime includes support for portably creating threads on POSIX and Windows systems..." alt="" coords="7,5,84,35"/></map> </td></tr></table></center> </div> <h2><a name="nested-classes"></a> Data Structures</h2> <ul> <li>union <a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> <dl class="el"><dd class="mdescRight">Mutex. <a href="unionglobus__mutex__t.html#details">More...</a><br/></dl><li>union <a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> <dl class="el"><dd class="mdescRight">Mutex attribute. <a href="unionglobus__mutexattr__t.html#details">More...</a><br/></dl><li>struct <a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> <dl class="el"><dd class="mdescRight">Recursive Mutex. <a href="structglobus__rmutex__t.html#details">More...</a><br/></dl></ul> <h2><a name="typedef-members"></a> Typedefs</h2> <ul> <li>typedef int <a class="el" href="group__globus__mutex.html#ga393b167864ed6de6974e6531e18c49f7">globus_rmutexattr_t</a> </ul> <h2><a name="func-members"></a> Functions</h2> <ul> <li>int <a class="el" href="group__globus__mutex.html#ga3ff7b5a88fc262ec7751db6b7ffce13f">globus_mutex_init</a> (<a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> *mutex, <a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> *attr) <li>int <a class="el" href="group__globus__mutex.html#ga9417e7b0f8c9ca048585f68f8abbc9b8">globus_mutex_destroy</a> (<a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> *mutex) <li>int <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d">globus_mutex_lock</a> (<a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> *mutex) <li>int <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531">globus_mutex_unlock</a> (<a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> *mutex) <li>int <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8">globus_mutex_trylock</a> (<a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> *mutex) <li>int <a class="el" href="group__globus__mutex.html#gae5763a14b7f8f8b1f8372394e162d2ef">globus_mutexattr_init</a> (<a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> *attr) <li>int <a class="el" href="group__globus__mutex.html#gaabcb4021e84485c4c4cbd20ce5771393">globus_mutexattr_destroy</a> (<a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> *attr) </ul> <h2><a name="member-group"></a> Recursive Mutex</h2> <ul> <li>int <a class="el" href="group__globus__mutex.html#gaa72a6972fef363a21bf49b743f37333d">globus_rmutex_init</a> (<a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> *rmutex, <a class="el" href="group__globus__mutex.html#ga393b167864ed6de6974e6531e18c49f7">globus_rmutexattr_t</a> *rattr) <li>int <a class="el" href="group__globus__mutex.html#ga0e104ab44374ecd4a4e5127889da2df5">globus_rmutex_lock</a> (<a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> *rmutex) <li>int <a class="el" href="group__globus__mutex.html#ga426c89b89ff57098b98fe5fd5730fd0a">globus_rmutex_unlock</a> (<a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> *rmutex) <li>int <a class="el" href="group__globus__mutex.html#ga15128a4a5ad759025ca7194b4fabc295">globus_rmutex_destroy</a> (<a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> *rmutex) </ul> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <p>The Globus runtime includes three portable, related mutual exclusion primitives that can be used in applications and libraries. These are</p> <ul> <li><a class="el" href="unionglobus__mutex__t.html" title="Mutex.">globus_mutex_t</a>: a non-recursive, non-shared lock</li> <li><a class="el" href="structglobus__rmutex__t.html" title="Recursive Mutex.">globus_rmutex_t</a>: a recursive non-shared lock</li> <li>globus_rw_mutex_t: a reader-writer lock </li> </ul> <hr/><h2>Typedef Documentation</h2> <a class="anchor" id="ga393b167864ed6de6974e6531e18c49f7"></a><!-- doxytag: member="globus_thread_rmutex.h::globus_rmutexattr_t" ref="ga393b167864ed6de6974e6531e18c49f7" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef int <a class="el" href="group__globus__mutex.html#ga393b167864ed6de6974e6531e18c49f7">globus_rmutexattr_t</a></td> </tr> </table> </div> <div class="memdoc"> <p>Recursive mutex attribute. </p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="ga3ff7b5a88fc262ec7751db6b7ffce13f"></a><!-- doxytag: member="globus_thread.c::globus_mutex_init" ref="ga3ff7b5a88fc262ec7751db6b7ffce13f" args="(globus_mutex_t *mutex, globus_mutexattr_t *attr)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutex_init </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> * </td> <td class="paramname"><em>mutex</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> * </td> <td class="paramname"><em>attr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize a mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga3ff7b5a88fc262ec7751db6b7ffce13f" title="Initialize a mutex.">globus_mutex_init()</a> function creates a mutex variable that can be used for synchronization. Currently, the <em>attr</em> parameter is ignored.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mutex</td><td>Pointer to the mutex to initialize. </td></tr> <tr><td class="paramname">attr</td><td>Ignored.</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#ga3ff7b5a88fc262ec7751db6b7ffce13f" title="Initialize a mutex.">globus_mutex_init()</a> initializes the mutex and returns GLOBUS_SUCCESS. Otherwise, a non-0 value is returned. </dd></dl> </div> </div> <a class="anchor" id="ga9417e7b0f8c9ca048585f68f8abbc9b8"></a><!-- doxytag: member="globus_thread.c::globus_mutex_destroy" ref="ga9417e7b0f8c9ca048585f68f8abbc9b8" args="(globus_mutex_t *mutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutex_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> * </td> <td class="paramname"><em>mutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destroy a mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga9417e7b0f8c9ca048585f68f8abbc9b8" title="Destroy a mutex.">globus_mutex_destroy()</a> function destroys the mutex pointed to by its <em>mutex</em> parameter. After a mutex is destroyed it may no longer be used unless it is again initialized by <a class="el" href="group__globus__mutex.html#ga3ff7b5a88fc262ec7751db6b7ffce13f" title="Initialize a mutex.">globus_mutex_init()</a>. Behavior is undefined if <a class="el" href="group__globus__mutex.html#ga9417e7b0f8c9ca048585f68f8abbc9b8" title="Destroy a mutex.">globus_mutex_destroy()</a> is called with a pointer to a locked mutex.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mutex</td><td>The mutex to destroy </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#ga9417e7b0f8c9ca048585f68f8abbc9b8" title="Destroy a mutex.">globus_mutex_destroy()</a> returns GLOBUS_SUCCESS. Otherwise, a non-zero implementation-specific error value is returned. </dd></dl> </div> </div> <a class="anchor" id="ga053b5f9b263f11b7305efdbee881bf5d"></a><!-- doxytag: member="globus_thread.c::globus_mutex_lock" ref="ga053b5f9b263f11b7305efdbee881bf5d" args="(globus_mutex_t *mutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutex_lock </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> * </td> <td class="paramname"><em>mutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Lock a mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> function locks the mutex pointed to by its <em>mutex</em> parameter. Upon successful return, the thread calling <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> has an exclusive lock on the resources protected by <em>mutex</em>. Other threads calling <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> will wait until that thread later calls <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531" title="Unlock a mutex.">globus_mutex_unlock()</a> or <a class="el" href="group__globus__cond.html#ga9b58106e5b1b2545ab45db0e3e4f98b0" title="Wait for a condition to be signalled.">globus_cond_wait()</a> with that mutex. Depending on the thread model, calling globus_mutex_lock on a mutex locked by the current thread will either return an error or result in deadlock.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mutex</td><td>The mutex to lock. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> returns GLOBUS_SUCCESS. Otherwise, a non-zero implementation-specific error value is returned. </dd></dl> </div> </div> <a class="anchor" id="ga8074266ebb8c3359a6078ffe654cc531"></a><!-- doxytag: member="globus_thread.c::globus_mutex_unlock" ref="ga8074266ebb8c3359a6078ffe654cc531" args="(globus_mutex_t *mutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutex_unlock </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> * </td> <td class="paramname"><em>mutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Unlock a mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531" title="Unlock a mutex.">globus_mutex_unlock()</a> function unlocks the mutex pointed to by its <em>mutex</em> parameter. Upon successful return, the thread calling <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531" title="Unlock a mutex.">globus_mutex_unlock()</a> no longer has an exclusive lock on the resources protected by <em>mutex</em>. Another thread calling <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> may be unblocked so that it may acquire the mutex. Behavior is undefined if globus_mutex_unlock is called with an unlocked mutex.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mutex</td><td>The mutex to unlock. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531" title="Unlock a mutex.">globus_mutex_unlock()</a> returns GLOBUS_SUCCESS. Otherwise, a non-zero implementation-specific error value is returned. </dd></dl> </div> </div> <a class="anchor" id="ga796547c088462e8c35ef87e279d27fb8"></a><!-- doxytag: member="globus_thread.c::globus_mutex_trylock" ref="ga796547c088462e8c35ef87e279d27fb8" args="(globus_mutex_t *mutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutex_trylock </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutex__t.html">globus_mutex_t</a> * </td> <td class="paramname"><em>mutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Lock a mutex if it is not locked. </p> <p>The <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8" title="Lock a mutex if it is not locked.">globus_mutex_trylock()</a> function locks the mutex pointed to by its <em>mutex</em> parameter if no thread has already locked the mutex. If <em>mutex</em> is locked, then <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8" title="Lock a mutex if it is not locked.">globus_mutex_trylock()</a> returns EBUSY and does not block the current thread or lock the mutex. Upon successful return, the thread calling <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8" title="Lock a mutex if it is not locked.">globus_mutex_trylock()</a> has an exclusive lock on the resources protected by <em>mutex</em>. Other threads calling <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> will wait until that thread later calls <a class="el" href="group__globus__mutex.html#ga8074266ebb8c3359a6078ffe654cc531" title="Unlock a mutex.">globus_mutex_unlock()</a> or <a class="el" href="group__globus__cond.html#ga9b58106e5b1b2545ab45db0e3e4f98b0" title="Wait for a condition to be signalled.">globus_cond_wait()</a> with that mutex.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">mutex</td><td>The mutex to lock. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8" title="Lock a mutex if it is not locked.">globus_mutex_trylock()</a> returns GLOBUS_SUCCESS and locks the mutex. If another thread holds the lock, <a class="el" href="group__globus__mutex.html#ga796547c088462e8c35ef87e279d27fb8" title="Lock a mutex if it is not locked.">globus_mutex_trylock()</a> returns EBUSY. Otherwise, a non-zero implementation-specific error value is returned. </dd></dl> </div> </div> <a class="anchor" id="gae5763a14b7f8f8b1f8372394e162d2ef"></a><!-- doxytag: member="globus_thread.c::globus_mutexattr_init" ref="gae5763a14b7f8f8b1f8372394e162d2ef" args="(globus_mutexattr_t *attr)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutexattr_init </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> * </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize a mutex attribute. </p> <p>The <a class="el" href="group__globus__mutex.html#gae5763a14b7f8f8b1f8372394e162d2ef" title="Initialize a mutex attribute.">globus_mutexattr_init()</a> function initializes the mutex attribute structure pointed to by its <em>attr</em> parameter. Currently there are no attribute values that can be set via this API, so there's no real use to calling this function.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>Attribute structure to initialize.</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>Upon success, <a class="el" href="group__globus__mutex.html#gae5763a14b7f8f8b1f8372394e162d2ef" title="Initialize a mutex attribute.">globus_mutexattr_init()</a> returns GLOBUS_SUCCESS and modifies the attribute pointed to by <em>attr</em>. If an error occurs, <a class="el" href="group__globus__mutex.html#gae5763a14b7f8f8b1f8372394e162d2ef" title="Initialize a mutex attribute.">globus_mutexattr_init()</a> returns an implementation-specific non-zero error code. </dd></dl> </div> </div> <a class="anchor" id="gaabcb4021e84485c4c4cbd20ce5771393"></a><!-- doxytag: member="globus_thread.c::globus_mutexattr_destroy" ref="gaabcb4021e84485c4c4cbd20ce5771393" args="(globus_mutexattr_t *attr)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_mutexattr_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__mutexattr__t.html">globus_mutexattr_t</a> * </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destroy a mutex attribute. </p> <p>The <a class="el" href="group__globus__mutex.html#gaabcb4021e84485c4c4cbd20ce5771393" title="Destroy a mutex attribute.">globus_mutexattr_destroy()</a> function destroys the mutex attribute structure pointed to by its <em>attr</em> parameter.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>Attribute structure to destroy.</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>Upon success, <a class="el" href="group__globus__mutex.html#gaabcb4021e84485c4c4cbd20ce5771393" title="Destroy a mutex attribute.">globus_mutexattr_destroy()</a> returns GLOBUS_SUCCESS and modifies the attribute pointed to by <em>attr</em>. If an error occurs, <a class="el" href="group__globus__mutex.html#gaabcb4021e84485c4c4cbd20ce5771393" title="Destroy a mutex attribute.">globus_mutexattr_destroy()</a> returns an implementation-specific non-zero error code. </dd></dl> </div> </div> <a class="anchor" id="gaa72a6972fef363a21bf49b743f37333d"></a><!-- doxytag: member="globus_thread_rmutex.c::globus_rmutex_init" ref="gaa72a6972fef363a21bf49b743f37333d" args="(globus_rmutex_t *rmutex, globus_rmutexattr_t *rattr)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_rmutex_init </td> <td>(</td> <td class="paramtype"><a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> * </td> <td class="paramname"><em>rmutex</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__globus__mutex.html#ga393b167864ed6de6974e6531e18c49f7">globus_rmutexattr_t</a> * </td> <td class="paramname"><em>rattr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Initialize a recursive mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#gaa72a6972fef363a21bf49b743f37333d" title="Initialize a recursive mutex.">globus_rmutex_init()</a> function initializes a recursive mutex, that is, one which may be locked multiple times by a single thread without causing deadlock. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rmutex</td><td>A pointer to the mutex to initialize </td></tr> <tr><td class="paramname">rattr</td><td>IGNORED</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#gaa72a6972fef363a21bf49b743f37333d" title="Initialize a recursive mutex.">globus_rmutex_init()</a> initializes the mutex and returns GLOBUS_SUCCESS; otherwise, it returns a non-zero error code. </dd></dl> </div> </div> <a class="anchor" id="ga0e104ab44374ecd4a4e5127889da2df5"></a><!-- doxytag: member="globus_thread_rmutex.c::globus_rmutex_lock" ref="ga0e104ab44374ecd4a4e5127889da2df5" args="(globus_rmutex_t *rmutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_rmutex_lock </td> <td>(</td> <td class="paramtype"><a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> * </td> <td class="paramname"><em>rmutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Lock a recursive mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga0e104ab44374ecd4a4e5127889da2df5" title="Lock a recursive mutex.">globus_rmutex_lock()</a> function acquires the lock controlled by <em>rmutex</em>. This may be called multiple times in a single thread without causing deadlock, provided that a call to <a class="el" href="group__globus__mutex.html#ga426c89b89ff57098b98fe5fd5730fd0a" title="Unlock a recursive mutex.">globus_rmutex_unlock()</a> is called the same number of times as <a class="el" href="group__globus__mutex.html#ga0e104ab44374ecd4a4e5127889da2df5" title="Lock a recursive mutex.">globus_rmutex_lock()</a>. Once acquired, all other threads calling this function will be blocked until the mutex is completely unlocked.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rmutex</td><td>A pointer to the mutex to lock</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__mutex.html#gaa72a6972fef363a21bf49b743f37333d" title="Initialize a recursive mutex.">globus_rmutex_init()</a> increases the lock level for the mutex, blocks other threads trying to acquire the same mutex, and returns GLOBUS_SUCCESS; otherwise, it returns a non-zero error code. </dd></dl> </div> </div> <a class="anchor" id="ga426c89b89ff57098b98fe5fd5730fd0a"></a><!-- doxytag: member="globus_thread_rmutex.c::globus_rmutex_unlock" ref="ga426c89b89ff57098b98fe5fd5730fd0a" args="(globus_rmutex_t *rmutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_rmutex_unlock </td> <td>(</td> <td class="paramtype"><a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> * </td> <td class="paramname"><em>rmutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Unlock a recursive mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga426c89b89ff57098b98fe5fd5730fd0a" title="Unlock a recursive mutex.">globus_rmutex_unlock()</a> function decrements the lock count for the lock pointed to by <em>rmutex</em>. If the lock count is reduced to zero, it also unblocks a thread which is trying to acquire the lock if there is one.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rmutex</td><td>Mutex to unlock</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>GLOBUS_SUCCESS </dd></dl> </div> </div> <a class="anchor" id="ga15128a4a5ad759025ca7194b4fabc295"></a><!-- doxytag: member="globus_thread_rmutex.c::globus_rmutex_destroy" ref="ga15128a4a5ad759025ca7194b4fabc295" args="(globus_rmutex_t *rmutex)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_rmutex_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="structglobus__rmutex__t.html">globus_rmutex_t</a> * </td> <td class="paramname"><em>rmutex</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Destroy a recursive mutex. </p> <p>The <a class="el" href="group__globus__mutex.html#ga15128a4a5ad759025ca7194b4fabc295" title="Destroy a recursive mutex.">globus_rmutex_destroy()</a> function destroys a recursive mutex If the mutex is currently locked, behavior is undefined.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">rmutex</td><td>Mutex to unlock</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>GLOBUS_SUCCESS </dd></dl> </div> </div> </div> </div> <div id="nav-path" class="navpath"> <ul> <hr> <p align="center"> <a href="http://www.globus.org/toolkit/about.html" target="_top">about globus</a> | <a href="http://www.globus.org/toolkit/" target="_top">globus toolkit</a> | <a href="https://dev.globus.org/wiki/Welcome/" target="_top">dev.globus</a> <br> <br> Comments? <a href="mailto:webmaster@globus.org">webmaster@globus.org</a> </body> </html>