Mutex: Difference between revisions

Content added Content deleted
(→‎{{header|C}}: posix mutex)
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++}}==