<!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.8.3.1 --> <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><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('group__globus__thread__once.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Macros</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">One-time execution<div class="ingroups"><a class="el" href="group__globus__thread.html">Threading</a></div></div> </div> </div><!--header--> <div class="contents"> <div class="dynheader"> Collaboration diagram for One-time execution:</div> <div class="dyncontent"> <center><table><tr><td><img src="group__globus__thread__once.png" border="0" alt="" usemap="#group____globus____thread____once"/> <map name="group____globus____thread____once" id="group____globus____thread____once"> <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="6,5,85,32"/></map> </td></tr></table></center> </div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">union  </td><td class="memItemRight" valign="bottom"><a class="el" href="unionglobus__thread__once__t.html">globus_thread_once_t</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:ga38b6477d7d8d53dcbbf6a6f8efc48128"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__globus__thread__once.html#ga38b6477d7d8d53dcbbf6a6f8efc48128">GLOBUS_THREAD_ONCE_INIT</a>   { .none = 0 }</td></tr> <tr class="separator:ga38b6477d7d8d53dcbbf6a6f8efc48128"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:gae997dbf80ee410d7762083c5e3967b27"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__globus__thread__once.html#gae997dbf80ee410d7762083c5e3967b27">globus_thread_once</a> (<a class="el" href="unionglobus__thread__once__t.html">globus_thread_once_t</a> *once, void(*init_routine)(void))</td></tr> <tr class="separator:gae997dbf80ee410d7762083c5e3967b27"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <p>The <a class="el" href="unionglobus__thread__once__t.html" title="Thread once structure.">globus_thread_once_t</a> provides a way for applications and libraries to execute some code exactly one time, independent of the number of threads which attempt to execute it. To use this, statically initialize a <a class="el" href="unionglobus__thread__once__t.html" title="Thread once structure.">globus_thread_once_t</a> control with the value GLOBUS_THREAD_ONCE_INIT, and pass a pointer to a function to execute once, along with the control, to <a class="el" href="group__globus__thread__once.html#gae997dbf80ee410d7762083c5e3967b27" title="Execute a function one time.">globus_thread_once()</a>. </p> <h2 class="groupheader">Macro Definition Documentation</h2> <a class="anchor" id="ga38b6477d7d8d53dcbbf6a6f8efc48128"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define GLOBUS_THREAD_ONCE_INIT   { .none = 0 }</td> </tr> </table> </div><div class="memdoc"> <p>Thread once initializer value. </p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="gae997dbf80ee410d7762083c5e3967b27"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int globus_thread_once </td> <td>(</td> <td class="paramtype"><a class="el" href="unionglobus__thread__once__t.html">globus_thread_once_t</a> * </td> <td class="paramname"><em>once</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void(*)(void) </td> <td class="paramname"><em>init_routine</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Execute a function one time. </p> <pre class="fragment">The globus_thread_once() function will execute the function pointed to by its @a init_routine parameter one time for each unique globus_thread_once_t object passed to it, independent of the number of threads calling it. The @a once value must be a static value initialized to GLOBUS_THREAD_ONCE_INIT. </pre><dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">once</td><td>A pointer to the value used to govern whether the function passed via the <em>init_routine</em> parameter has executed. </td></tr> <tr><td class="paramname">init_routine</td><td>Function to execute one time. It is called with no parameters.</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>On success, <a class="el" href="group__globus__thread__once.html#gae997dbf80ee410d7762083c5e3967b27" title="Execute a function one time.">globus_thread_once()</a> guarantees that the function pointed to by <em>init_routine</em> has run, and that subsequent calls to <a class="el" href="group__globus__thread__once.html#gae997dbf80ee410d7762083c5e3967b27" title="Execute a function one time.">globus_thread_once()</a> with the same value of <em>once</em> will not execute that function, and returns GLOBUS_SUCCESS. If an error occurs, <a class="el" href="group__globus__thread__once.html#gae997dbf80ee410d7762083c5e3967b27" title="Execute a function one time.">globus_thread_once()</a> returns an implementation-specific non-zero error value. </dd></dl> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <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>