Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

call_once(3C)

Name

call_once - initialization function

Synopsis

#include <threads.h>
once_flag flag = ONCE_FLAG_INIT;
void call_once(once_flag *flag, void (*func)(void));

Description

The call_once() function is specified in the C11 standard. It is a simple wrapper over the more general pthreads function pthread_once(3C). See INCITS/ISO/IEC 9899:2011.

The object pointed to by flag must be initialized with the value ONCE_FLAG_INIT before any call to the call_once() function using that object and it must not be modified again before the last call to call_once() using that object.

The constant ONCE_FLAG_INIT is defined in the <threads.h> header.

Return Values

No value is returned by the call_once() function.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See Also

pthread_once(3C), threads.h(3HEAD), attributes(7)