call_once - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# call_once

From cppreference.com
< c‎ | thread

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)

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/thread/call_once&oldid=63538"