Next: , Previous: , Up: ISO C Threads   [Contents][Index]

35.1.3 Call Once

In order to guarantee single access to a function, the GNU C Library implements a call once function to ensure a function is only called once in the presence of multiple, potentially calling threads.

Data Type: once_flag

A complete object type capable of holding a flag used by call_once.


This value is used to initialize an object of type once_flag.

Function: void call_once (once_flag *flag, void (*func) (void))

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

call_once calls function func exactly once, even if invoked from several threads. The completion of the function func synchronizes-with all previous or subsequent calls to call_once with the same flag variable.