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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Condition Variable Functions<br />

<strong>in</strong>t cnd_<strong>in</strong>it(cnd_t* cond);<br />

void cnd_destroy(cnd_t* cond);<br />

<strong>in</strong>t cnd_signal(cnd_t* cond);<br />

<strong>in</strong>t cnd_broadcast(cnd_t* cond);<br />

<strong>in</strong>t cnd_wait(cnd_t* cond, mtx_t* mtx);<br />

<strong>in</strong>t cnd_timedwait(cnd_t* cond, mtx_t* mtx, const xtime* xt);<br />

These functions are all similar to <strong>the</strong> correspond<strong>in</strong>g Pthreads<br />

functions, except that Pthread condition variables can have certa<strong>in</strong><br />

attributes and be statically <strong>in</strong>itialized.<br />

<strong>in</strong>t pthread_cond_<strong>in</strong>it(<br />

pthread_cond_t* restrict cond,<br />

const pthread_condattr_t* restrict attr);<br />

pthread_cond_t cond = PTHREAD_COND_INITIALIZER;<br />

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

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

Saved successfully!

Ooh no, something went wrong!