06.08.2013 Views

Threads in the new ISO C Standard from 2011

Threads in the new ISO C Standard from 2011

Threads in the new ISO C Standard from 2011

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Initialization Function<br />

void call_once(once_flag* flag, void (*func)(void));<br />

The flag should be <strong>in</strong>itialized with:<br />

once_flag flag = ONCE_FLAG_INIT;<br />

If multiple threads <strong>in</strong>voke call_once with <strong>the</strong> same flag, <strong>the</strong> function<br />

will only be called one time, and <strong>the</strong> o<strong>the</strong>rs will wait until <strong>the</strong> call to<br />

func returns.<br />

Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 63 / 70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!