.TH "One-time execution" 3 "Sat Nov 8 2014" "Version 15.26" "globus_common" \" -*- nroff -*- .ad l .nh .SH NAME One-time execution \- .SS "Data Structures" .in +1c .ti -1c .RI "union \fBglobus_thread_once_t\fP" .br .RI "\fIThread once structure\&. \fP" .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBGLOBUS_THREAD_ONCE_INIT\fP { \&.none = 0 }" .br .RI "\fIThread once initializer value\&. \fP" .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBglobus_thread_once\fP (\fBglobus_thread_once_t\fP *once, void(*init_routine)(void))" .br .RI "\fIExecute a function one time\&. \fP" .in -1c .SH "Detailed Description" .PP The \fBglobus_thread_once_t\fP 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 \fBglobus_thread_once_t\fP control with the value GLOBUS_THREAD_ONCE_INIT, and pass a pointer to a function to execute once, along with the control, to \fBglobus_thread_once()\fP\&. .SH "Function Documentation" .PP .SS "int globus_thread_once (\fBglobus_thread_once_t\fP *once, void(*)(void)init_routine)" .PP Execute a function one time\&. The \fBglobus_thread_once()\fP function will execute the function pointed to by its \fIinit_routine\fP parameter one time for each unique \fBglobus_thread_once_t\fP object passed to it, independent of the number of threads calling it\&. The \fIonce\fP value must be a static value initialized to GLOBUS_THREAD_ONCE_INIT\&. .PP \fBParameters:\fP .RS 4 \fIonce\fP A pointer to the value used to govern whether the function passed via the \fIinit_routine\fP parameter has executed\&. .br \fIinit_routine\fP Function to execute one time\&. It is called with no parameters\&. .RE .PP \fBReturns:\fP .RS 4 On success, \fBglobus_thread_once()\fP guarantees that the function pointed to by \fIinit_routine\fP has run, and that subsequent calls to \fBglobus_thread_once()\fP with the same value of \fIonce\fP will not execute that function, and returns GLOBUS_SUCCESS\&. If an error occurs, \fBglobus_thread_once()\fP returns an implementation-specific non-zero error value\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for globus_common from the source code\&.