Anonymous user
Mutex: Difference between revisions
→POSIX
(→{{header|C}}: posix mutex) |
(→POSIX) |
||
Line 95:
<c>#include <pthread.h>
int success = pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;</c>
Locking:
<c>int success = pthread_mutex_lock(&mutex);</c>
Unlocking:
<c>int success = pthread_mutex_unlock(&mutex);</c>
Trying to lock (but do not wait it can't)
<c>int success = pthread_mutex_trylock(&mutex);</c>
=={{header|C++}}==
|