Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 5eb826aa4501ed8d8df68ed910a162ee > files > 85

globus-common-doc-14.6-1.fc15.noarch.rpm

<!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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;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__thread.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#groups">Modules</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Threading</div>  </div>
</div>
<div class="contents">

<p>The Globus runtime includes support for portably creating threads on POSIX and Windows systems.  
<a href="#details">More...</a></p>
<div class="dynheader">
Collaboration diagram for Threading:</div>
<div class="dyncontent">
<center><table><tr><td><img src="group__globus__thread.png" border="0" alt="" usemap="#group____globus____thread"/>
<map name="group____globus____thread" id="group____globus____thread">
<area shape="rect" id="node2" href="group__globus__mutex.html" title="Mutual Exclusion" alt="" coords="153,5,276,35"/><area shape="rect" id="node3" href="group__globus__thread__key.html" title="Thread&#45;Specific Storage" alt="" coords="133,59,296,88"/><area shape="rect" id="node4" href="group__globus__cond.html" title="Condition Variables" alt="" coords="148,112,281,141"/><area shape="rect" id="node5" href="group__globus__thread__once.html" title="One&#45;time execution" alt="" coords="148,165,281,195"/></map>
</td></tr></table></center>
</div>
<h2><a name="nested-classes"></a>
Data Structures</h2>
<ul>
<li>union <a class="el" href="unionglobus__thread__t.html">globus_thread_t</a>
<dl class="el"><dd class="mdescRight">Thread ID.  <a href="unionglobus__thread__t.html#details">More...</a><br/></dl><li>union <a class="el" href="unionglobus__threadattr__t.html">globus_threadattr_t</a>
<dl class="el"><dd class="mdescRight">Thread attributes.  <a href="unionglobus__threadattr__t.html#details">More...</a><br/></dl><li>union <a class="el" href="unionglobus__thread__key__t.html">globus_thread_key_t</a>
<dl class="el"><dd class="mdescRight">Thread-specific data key.  <a href="unionglobus__thread__key__t.html#details">More...</a><br/></dl></ul>
<h2><a name="groups"></a>
Modules</h2>
<ul>
<li><a class="el" href="group__globus__mutex.html">Mutual Exclusion</a>
<li><a class="el" href="group__globus__cond.html">Condition Variables</a>
<li><a class="el" href="group__globus__thread__key.html">Thread-Specific Storage</a>
<li><a class="el" href="group__globus__thread__once.html">One-time execution</a>
</ul>
<h2><a name="define-members"></a>
Defines</h2>
<ul>
<li>#define <a class="el" href="group__globus__thread.html#gaf15a5fb8ed82c9a48bf3315bfe1142c9">GLOBUS_THREAD_CANCEL_DISABLE</a>&#160;&#160;&#160;0
<li>#define <a class="el" href="group__globus__thread.html#ga54aa25c95e89566ba181eea9733651d0">GLOBUS_THREAD_CANCEL_ENABLE</a>&#160;&#160;&#160;1
<li>#define <a class="el" href="group__globus__thread.html#ga1e4ac32bb0133044557d82ae454c5524">GLOBUS_THREAD_MODULE</a>&#160;&#160;&#160;(&amp;globus_i_thread_module)
</ul>
<h2><a name="typedef-members"></a>
Typedefs</h2>
<ul>
<li>typedef void(* <a class="el" href="group__globus__thread.html#gab9a4db7600579bd5aad4383fa57551d9">globus_thread_key_destructor_func_t</a> )(void *value)
</ul>
<h2><a name="func-members"></a>
Functions</h2>
<ul>
<li>int <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b">globus_thread_set_model</a> (const char *model)
<li>int <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775">globus_thread_create</a> (<a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> *thread, <a class="el" href="unionglobus__threadattr__t.html">globus_threadattr_t</a> *attr, globus_thread_func_t func, void *user_arg)
<li>void <a class="el" href="group__globus__thread.html#ga6a6e15c71b17287216b6503861386d37">globus_thread_yield</a> (void)
<li>void <a class="el" href="group__globus__thread.html#gad82ec7a9a046558859124766c85e8491">globus_thread_exit</a> (void *value)
<li>int <a class="el" href="group__globus__thread.html#gadf6ddab884b07297c0699e9793aa8726">globus_thread_sigmask</a> (int how, const sigset_t *new_mask, sigset_t *old_mask)
<li>int <a class="el" href="group__globus__thread.html#gae606e850d19fd3fe438fa6bfc6515394">globus_thread_kill</a> (<a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> thread, int sig)
<li><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> <a class="el" href="group__globus__thread.html#ga0075f9c3c3c1e2a2eb41a10913ccfca6">globus_thread_self</a> (void)
<li>globus_bool_t <a class="el" href="group__globus__thread.html#ga0858d6945cc5ed82cec65eadd2ef0a32">globus_thread_equal</a> (<a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> thread1, <a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> thread2)
<li>globus_bool_t <a class="el" href="group__globus__thread.html#ga138729b018e3e31bd591d9421af656f7">globus_thread_preemptive_threads</a> (void)
<li>globus_bool_t <a class="el" href="group__globus__thread.html#ga8df3fff10bd599db534519b6907e1922">globus_i_am_only_thread</a> (void)
<li>void * <a class="el" href="group__globus__thread.html#ga990a7deb9ec83c5bf4ca8a25d1fdc3a0">globus_thread_cancellable_func</a> (void *(*func)(void *), void *arg, void(*cleanup_func)(void *), void *cleanup_arg, globus_bool_t execute_cleanup)
<li>int <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f">globus_thread_cancel</a> (<a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> thr)
<li>void <a class="el" href="group__globus__thread.html#gae0397b4b91b07b45d27f30ba5954bc7c">globus_thread_testcancel</a> (void)
<li>int <a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c">globus_thread_setcancelstate</a> (int state, int *oldstate)
</ul>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>The Globus runtime includes support for portably creating threads on POSIX and Windows systems. </p>
<p>It also provides a callback-driven system for applications that may use threads but don't require them. The Globus Thread API is modeled closely after the POSIX threads API.</p>
<p>Applications can choose whether to run as threaded or non-threaded at runtime by either setting the GLOBUS_THREAD_MODEL environment variable or calling the <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b" title="Select threading model for an application.">globus_thread_set_model()</a> function prior to activating any Globus modules.</p>
<p>The Globus thread system provides primitives for mutual exclusion (<a class="el" href="unionglobus__mutex__t.html" title="Mutex.">globus_mutex_t</a>, <a class="el" href="structglobus__rmutex__t.html" title="Recursive Mutex.">globus_rmutex_t</a>, globus_rw_mutex_t), event synchronization (<a class="el" href="unionglobus__cond__t.html" title="Condition variable.">globus_cond_t</a>), one-time execution (globus_once_t), and threading (<a class="el" href="unionglobus__thread__t.html" title="Thread ID.">globus_thread_t</a>).</p>
<p>In non-threaded operation, <a class="el" href="group__globus__cond.html#ga9b58106e5b1b2545ab45db0e3e4f98b0" title="Wait for a condition to be signalled.">globus_cond_wait()</a> and its variants will poll the callback queue and I/O system to allow event-driven programs to run in the absence of threads. The <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775" title="Create a new thread.">globus_thread_create()</a> function will fail in that model. Other primitive operations will return success but not provide any thread exclusion as there is only one thread. </p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="gaf15a5fb8ed82c9a48bf3315bfe1142c9"></a><!-- doxytag: member="globus_thread.h::GLOBUS_THREAD_CANCEL_DISABLE" ref="gaf15a5fb8ed82c9a48bf3315bfe1142c9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GLOBUS_THREAD_CANCEL_DISABLE&#160;&#160;&#160;0</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Disable thread cancellation value. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c" title="Set the thread&#39;s cancellable state.">globus_thread_setcancelstate()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ga54aa25c95e89566ba181eea9733651d0"></a><!-- doxytag: member="globus_thread.h::GLOBUS_THREAD_CANCEL_ENABLE" ref="ga54aa25c95e89566ba181eea9733651d0" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GLOBUS_THREAD_CANCEL_ENABLE&#160;&#160;&#160;1</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Enable thread cancellation value. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c" title="Set the thread&#39;s cancellable state.">globus_thread_setcancelstate()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ga1e4ac32bb0133044557d82ae454c5524"></a><!-- doxytag: member="globus_thread.h::GLOBUS_THREAD_MODULE" ref="ga1e4ac32bb0133044557d82ae454c5524" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define GLOBUS_THREAD_MODULE&#160;&#160;&#160;(&amp;globus_i_thread_module)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Thread Module. </p>

</div>
</div>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="gab9a4db7600579bd5aad4383fa57551d9"></a><!-- doxytag: member="globus_thread.h::globus_thread_key_destructor_func_t" ref="gab9a4db7600579bd5aad4383fa57551d9" args=")(void *value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef void(*  <a class="el" href="group__globus__thread.html#gab9a4db7600579bd5aad4383fa57551d9">globus_thread_key_destructor_func_t</a>)(void *value)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Thread-specific data destructor. </p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gab1e6b22b1d55346b3191402fdc7e341b"></a><!-- doxytag: member="globus_thread.c::globus_thread_set_model" ref="gab1e6b22b1d55346b3191402fdc7e341b" args="(const char *model)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_set_model </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>model</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Select threading model for an application. </p>
<p>The <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b" title="Select threading model for an application.">globus_thread_set_model()</a> function selects which runtime model the current application will use. By default, the Globus runtime uses a non-threaded model. Additional models may be available based on system support: pthread, or windows. This function must be called prior to activating any globus module, as it changes how certain functions (like <a class="el" href="group__globus__mutex.html#ga053b5f9b263f11b7305efdbee881bf5d" title="Lock a mutex.">globus_mutex_lock()</a> and <a class="el" href="group__globus__cond.html#ga9b58106e5b1b2545ab45db0e3e4f98b0" title="Wait for a condition to be signalled.">globus_cond_wait()</a>) behave. This function overrides the value set by the GLOBUS_THREAD_MODEL environment variable.</p>
<p>The <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b" title="Select threading model for an application.">globus_thread_set_model()</a> function will fail if a Globus module has been activated already.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">model</td><td>The name of the thread model to use. Depending on operating system capabilities, this may be "none", "pthread", "windows", or some other custom thread implementation. The corresponding libtool module "libglobus_thread_pthread.la" or "libglobus_thread_windows.la" must be installed on the system for it to be used.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b" title="Select threading model for an application.">globus_thread_set_model()</a> sets the name of the thread model to use and returns GLOBUS_SUCCESS. If an error occurs, then <a class="el" href="group__globus__thread.html#gab1e6b22b1d55346b3191402fdc7e341b" title="Select threading model for an application.">globus_thread_set_model()</a> returns GLOBUS_FAILURE. </dd></dl>

</div>
</div>
<a class="anchor" id="gac743f4cd1e4a49e6ccc23dea8d8a1775"></a><!-- doxytag: member="globus_thread.c::globus_thread_create" ref="gac743f4cd1e4a49e6ccc23dea8d8a1775" args="(globus_thread_t *thread, globus_threadattr_t *attr, globus_thread_func_t func, void *user_arg)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_create </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> *&#160;</td>
          <td class="paramname"><em>thread</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="unionglobus__threadattr__t.html">globus_threadattr_t</a> *&#160;</td>
          <td class="paramname"><em>attr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">globus_thread_func_t&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>user_arg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create a new thread. </p>
<p>The <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775" title="Create a new thread.">globus_thread_create()</a> function creates a new thread of execution in the current process to run the function pointed to by the <em>func</em> parameter passed the <em>user_arg</em> value as its only parameter. This new thread will be detached, so that storage associated with the thread will be automatically reclaimed by the operating system. A thread identifier will be copied to the value pointed by the <em>thread</em> parameter if it is non-NULL. The caller may use this thread identifier to signal or cancel this thread. The <em>attr</em> paramter is ignored by this function. If the "none" threading model is used by an application, then this function will always fail. One alternative that will work both with and without threads is to use the functions in the <a class="el" href="group__globus__callback.html">Globus Callback API </a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">thread</td><td>Pointer to a variable to contain the new thread's identifier. </td></tr>
    <tr><td class="paramname">attr</td><td>Ignored </td></tr>
    <tr><td class="paramname">func</td><td>Pointer to a function to start in the new thread. </td></tr>
    <tr><td class="paramname">user_arg</td><td>Argument to the new thread's function.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775" title="Create a new thread.">globus_thread_create()</a> will start a new thread, invoking (*func)(user_arg), modify the value pointed to by the <em>thread</em> parameter to contain the new thread's identifier and return GLOBUS_SUCCESS. If an error occurs, then the value of <em>thread</em> is undefined and <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775" title="Create a new thread.">globus_thread_create()</a> returns an implementation-specific non-zero error value. </dd></dl>

</div>
</div>
<a class="anchor" id="ga6a6e15c71b17287216b6503861386d37"></a><!-- doxytag: member="globus_thread.c::globus_thread_yield" ref="ga6a6e15c71b17287216b6503861386d37" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void globus_thread_yield </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Yield execution to another thread. </p>
<p>The <a class="el" href="group__globus__thread.html#ga6a6e15c71b17287216b6503861386d37" title="Yield execution to another thread.">globus_thread_yield()</a> function yields execution to other threads which are ready for execution. The current thread may continue to execute if there are no other threads in the system's ready queue. </p>

</div>
</div>
<a class="anchor" id="gad82ec7a9a046558859124766c85e8491"></a><!-- doxytag: member="globus_thread.c::globus_thread_exit" ref="gad82ec7a9a046558859124766c85e8491" args="(void *value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void globus_thread_exit </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>value</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Terminate the current threadThe <a class="el" href="group__globus__thread.html#gad82ec7a9a046558859124766c85e8491" title="Terminate the current threadThe globus_thread_exit() terminates the current thread with the value pas...">globus_thread_exit()</a> terminates the current thread with the value passed to it. </p>
<p>This function does not return. </p>

</div>
</div>
<a class="anchor" id="gadf6ddab884b07297c0699e9793aa8726"></a><!-- doxytag: member="globus_thread.c::globus_thread_sigmask" ref="gadf6ddab884b07297c0699e9793aa8726" args="(int how, const sigset_t *new_mask, sigset_t *old_mask)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_sigmask </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>how</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const sigset_t *&#160;</td>
          <td class="paramname"><em>new_mask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">sigset_t *&#160;</td>
          <td class="paramname"><em>old_mask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Modify the current thread's signal mask. </p>
<p>The <a class="el" href="group__globus__thread.html#gadf6ddab884b07297c0699e9793aa8726" title="Modify the current thread&#39;s signal mask.">globus_thread_sigmask()</a> function modifies the current thread's signal mask and returns the old value of the signal mask in the value pointed to by the <em>old_mask</em> parameter. The <em>how</em> parameter can be one of SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK to control how the signal mask is modified.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">how</td><td>Flag indicating how to interpret <em>new_mask</em> if it is non-NULL. If <em>how</em> is SIG_BLOCK, then all signals in <em>new_mask</em> are blocked, as well as any which were previously blocked. If <em>how</em> is SIG_UNBLOCK, then all signals in which were previously blocked in <em>new_mask</em> are unblocked. If <em>how</em> is SIG_SETMASK, then the old signal mask is replaced with the value of <em>new_mask</em>. </td></tr>
    <tr><td class="paramname">new_mask</td><td>Set of signals to block or unblock, based on the <em>how</em> parameter. </td></tr>
    <tr><td class="paramname">old_mask</td><td>A pointer to be set to the old signal mask associated with the current thread.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__thread.html#gadf6ddab884b07297c0699e9793aa8726" title="Modify the current thread&#39;s signal mask.">globus_thread_sigmask()</a> modifies the signal mask, modifies the value pointed to by <em>old_mask</em> with the signal mask prior to this function's execution and returns GLOBUS_SUCCESS. If an error occurs, <a class="el" href="group__globus__thread.html#gadf6ddab884b07297c0699e9793aa8726" title="Modify the current thread&#39;s signal mask.">globus_thread_sigmask()</a> returns an implementation-specific non-zero error value. </dd></dl>

</div>
</div>
<a class="anchor" id="gae606e850d19fd3fe438fa6bfc6515394"></a><!-- doxytag: member="globus_thread.c::globus_thread_kill" ref="gae606e850d19fd3fe438fa6bfc6515394" args="(globus_thread_t thread, int sig)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_kill </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a>&#160;</td>
          <td class="paramname"><em>thread</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>sig</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Send a signal to a thread. </p>
<p>The <a class="el" href="group__globus__thread.html#gae606e850d19fd3fe438fa6bfc6515394" title="Send a signal to a thread.">globus_thread_kill()</a> function sends the signal specified by the <em>sig</em> number to the thread whose ID matches the <em>thread</em> parameter. Depending on the signal mask of that thread, this may result in a signal being delivered or not, and depending on the process's signal actions, a signal handler, termination, or no operation will occur in that thread.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">thread</td><td>The thread identifier of the thread to signal. </td></tr>
    <tr><td class="paramname">sig</td><td>The signal to send to the thread. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, <a class="el" href="group__globus__thread.html#gae606e850d19fd3fe438fa6bfc6515394" title="Send a signal to a thread.">globus_thread_kill()</a> queues the signal for delivery to the specified thread and returns GLOBUS_SUCCESS. If an error occurs, <a class="el" href="group__globus__thread.html#gae606e850d19fd3fe438fa6bfc6515394" title="Send a signal to a thread.">globus_thread_kill()</a> returns an implementation-specific non-zero error value. </dd></dl>

</div>
</div>
<a class="anchor" id="ga0075f9c3c3c1e2a2eb41a10913ccfca6"></a><!-- doxytag: member="globus_thread.c::globus_thread_self" ref="ga0075f9c3c3c1e2a2eb41a10913ccfca6" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a> globus_thread_self </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Determine the current thread's ID. </p>
<p>The <a class="el" href="group__globus__thread.html#ga0075f9c3c3c1e2a2eb41a10913ccfca6" title="Determine the current thread&#39;s ID.">globus_thread_self()</a> function returns the thread identifier of the current thread. This value is unique among all threads which are running at any given time. </p>

</div>
</div>
<a class="anchor" id="ga0858d6945cc5ed82cec65eadd2ef0a32"></a><!-- doxytag: member="globus_thread.c::globus_thread_equal" ref="ga0858d6945cc5ed82cec65eadd2ef0a32" args="(globus_thread_t thread1, globus_thread_t thread2)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">globus_bool_t globus_thread_equal </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a>&#160;</td>
          <td class="paramname"><em>thread1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a>&#160;</td>
          <td class="paramname"><em>thread2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check whether thread identifiers match. </p>
<p>The <a class="el" href="group__globus__thread.html#ga0858d6945cc5ed82cec65eadd2ef0a32" title="Check whether thread identifiers match.">globus_thread_equal()</a> function checks whether the thread identifiers passed as the <em>thread1</em> and <em>thread2</em> parameters refer to the same thread. If so, <a class="el" href="group__globus__thread.html#ga0858d6945cc5ed82cec65eadd2ef0a32" title="Check whether thread identifiers match.">globus_thread_equal()</a> returns GLOBUS_TRUE; otherwise GLOBUS_FALSE.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">thread1</td><td>Thread identifier to compare. </td></tr>
    <tr><td class="paramname">thread2</td><td>Thread identifier to compare. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga138729b018e3e31bd591d9421af656f7"></a><!-- doxytag: member="globus_thread.c::globus_thread_preemptive_threads" ref="ga138729b018e3e31bd591d9421af656f7" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">globus_bool_t globus_thread_preemptive_threads </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Indicate whether the active thread model supports preemption. </p>
<p>The <a class="el" href="group__globus__thread.html#ga138729b018e3e31bd591d9421af656f7" title="Indicate whether the active thread model supports preemption.">globus_thread_preemptive_threads()</a> function returns GLOBUS_TRUE if the current thread model supports thread preemption; othwerise it returns GLOBUS_FALSE. </p>

</div>
</div>
<a class="anchor" id="ga8df3fff10bd599db534519b6907e1922"></a><!-- doxytag: member="globus_thread.c::globus_i_am_only_thread" ref="ga8df3fff10bd599db534519b6907e1922" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">globus_bool_t globus_i_am_only_thread </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Determine if threads are supported. </p>
<p>The <a class="el" href="group__globus__thread.html#ga8df3fff10bd599db534519b6907e1922" title="Determine if threads are supported.">globus_i_am_only_thread()</a> function returns GLOBUS_TRUE if the current thread model is the "none" thread model; GLOBUS_FALSE otherwise. If running with the "none" thread model, there will only be one Globus thread available and the <a class="el" href="group__globus__thread.html#gac743f4cd1e4a49e6ccc23dea8d8a1775" title="Create a new thread.">globus_thread_create()</a> function will always fail. </p>

</div>
</div>
<a class="anchor" id="ga990a7deb9ec83c5bf4ca8a25d1fdc3a0"></a><!-- doxytag: member="globus_thread.c::globus_thread_cancellable_func" ref="ga990a7deb9ec83c5bf4ca8a25d1fdc3a0" args="(void *(*func)(void *), void *arg, void(*cleanup_func)(void *), void *cleanup_arg, globus_bool_t execute_cleanup)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* globus_thread_cancellable_func </td>
          <td>(</td>
          <td class="paramtype">void *(*)(void *)&#160;</td>
          <td class="paramname"><em>func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>arg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *)&#160;</td>
          <td class="paramname"><em>cleanup_func</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>cleanup_arg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">globus_bool_t&#160;</td>
          <td class="paramname"><em>execute_cleanup</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Execute a function with thread cleanup in case of cancellation. </p>
<p>The <a class="el" href="group__globus__thread.html#ga990a7deb9ec83c5bf4ca8a25d1fdc3a0" title="Execute a function with thread cleanup in case of cancellation.">globus_thread_cancellable_func()</a> function provides an interface to POSIX thread cancellation points that does not rely on preprocessor macros. It is roughly equivalent to </p>
<div class="fragment"><pre class="fragment"> pthread_cleanup_push(cleanup_func, cleanup_arg);
 (*func)(arg);
 pthread_cleanup_pop(execute_cleanup)
</pre></div><dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">func</td><td>Pointer to a function which may be cancelled. </td></tr>
    <tr><td class="paramname">arg</td><td>Parameter to the <em>func</em> function. </td></tr>
    <tr><td class="paramname">cleanup_func</td><td>Pointer to a function to execute if thread cancellation occurs during <em>func</em>. </td></tr>
    <tr><td class="paramname">cleanup_arg</td><td>Parameter to the <em>cleanup_func</em> function. </td></tr>
    <tr><td class="paramname">execute_cleanup</td><td>Flag indicating whether the function pointed to by <em>cleanup_func</em> should be executed after <em>func</em> completes even if it is not cancelled.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="group__globus__thread.html#ga990a7deb9ec83c5bf4ca8a25d1fdc3a0" title="Execute a function with thread cleanup in case of cancellation.">globus_thread_cancellable_func()</a> returns the value returned by <em>func</em>. </dd></dl>

</div>
</div>
<a class="anchor" id="ga3aca327a5a9ed473446a788f255e793f"></a><!-- doxytag: member="globus_thread.c::globus_thread_cancel" ref="ga3aca327a5a9ed473446a788f255e793f" args="(globus_thread_t thr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_cancel </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="unionglobus__thread__t.html">globus_thread_t</a>&#160;</td>
          <td class="paramname"><em>thr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Cancel a thread. </p>
<p>The <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f" title="Cancel a thread.">globus_thread_cancel()</a> function cancels the thread with the identifier <em>thr</em> if it is still executing. If it is running with a cancellation cleanup stack, the functions in that stack are executed. The target thread's cancel state determines when the cancellation is delivered.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">thr</td><td>The id of the thread to cancel</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, the <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f" title="Cancel a thread.">globus_thread_cancel()</a> function delivers the cancellation to the target thread and returns GLOBUS_SUCCESS. If an error occurs, <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f" title="Cancel a thread.">globus_thread_cancel()</a> returns an implementation-specific non-zero error value. </dd></dl>

</div>
</div>
<a class="anchor" id="gae0397b4b91b07b45d27f30ba5954bc7c"></a><!-- doxytag: member="globus_thread.c::globus_thread_testcancel" ref="gae0397b4b91b07b45d27f30ba5954bc7c" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void globus_thread_testcancel </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Thread cancellation point. </p>
<p>The <a class="el" href="group__globus__thread.html#gae0397b4b91b07b45d27f30ba5954bc7c" title="Thread cancellation point.">globus_thread_testcancel()</a> function acts as a cancellation point for the current thread. If a thread has called <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f" title="Cancel a thread.">globus_thread_cancel()</a> and cancellation is enabled, this will cause the thread to be cancelled and any functions on the thread's cleanup stack to be executed. This function will not return if the thread is cancelled. </p>

</div>
</div>
<a class="anchor" id="ga201f97630ba96e417c65a9ffe4075e6c"></a><!-- doxytag: member="globus_thread.c::globus_thread_setcancelstate" ref="ga201f97630ba96e417c65a9ffe4075e6c" args="(int state, int *oldstate)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int globus_thread_setcancelstate </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>state</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>oldstate</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the thread's cancellable state. </p>
<p>The <a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c" title="Set the thread&#39;s cancellable state.">globus_thread_setcancelstate()</a> function sets the current cancellation state to either GLOBUS_THREAD_CANCEL_DISABLE or GLOBUS_THREAD_CANCEL_ENABLE, do control whether <a class="el" href="group__globus__thread.html#ga3aca327a5a9ed473446a788f255e793f" title="Cancel a thread.">globus_thread_cancel()</a> is able to cancel this thread.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">state</td><td>The desired cancellation state. If the value is GLOBUS_THREAD_CANCEL_DISABLE, then cancellation will be disabled for this thread. If the value is GLOBUS_THREAD_CANCEL_ENABLE, then cancellation will be enabled for this thread. </td></tr>
    <tr><td class="paramname">oldstate</td><td>A pointer to a value which will be set to the value of the thread's cancellation state when this function call began. This may be NULL if the caller is not interested in the previous value. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>On success, the <a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c" title="Set the thread&#39;s cancellable state.">globus_thread_setcancelstate()</a> function modifies the thread cancellation state, modifies oldstate (if non-NULL) to the value of its previous state, and returns GLOBUS_SUCCESS. If an error occurs, <a class="el" href="group__globus__thread.html#ga201f97630ba96e417c65a9ffe4075e6c" title="Set the thread&#39;s cancellable state.">globus_thread_setcancelstate()</a> returns an implementation-specific non-zero error value. </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>