Next: Mutexes, Previous: Creation and Control, Up: ISO C Threads [Contents][Index]
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.
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
.
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.