Namespaces
Variants
Views
Actions

call_once

From cppreference.com
< c‎ | thread
Revision as of 18:36, 9 July 2013 by P12bot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <threads.h>
void call_once( once_flag* flag, void (*func)(void) );
(since C11)

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.

[edit] Parameters

flag - pointer to an object that is used to ensure func is called only once
func - the function to execute

[edit] Return value

(none)