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.

Mutex Functions<br />

<strong>in</strong>t mtx_<strong>in</strong>it(mtx_t* mtx, <strong>in</strong>t type);<br />

void mtx_destroy(mtx_t* mtx);<br />

<strong>in</strong>t mtx_lock(mtx_t* mtx);<br />

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

<strong>in</strong>t mtx_trylock(mtx_t* mtx);<br />

<strong>in</strong>t mtx_unlock(mtx_t* mtx);<br />

The type should be one of:<br />

mtx_pla<strong>in</strong><br />

mtx_timed<br />

mtx_try<br />

mtx_pla<strong>in</strong> | mtx_recursive<br />

mtx_timed | mtx_recursive<br />

mtx_try | mtx_recursive<br />

Only mtx_trylock can return thrd_busy.<br />

A prior call to mtx_unlock synchronizes with a successful call to a<br />

mtx_lock function.<br />

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

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

Saved successfully!

Ooh no, something went wrong!