Multithreaded Programming Guide

Releasing a Mutex

Use mutex_unlock(3C) to unlock the mutex pointed to by mp. The mutex must be locked. The calling thread must be the thread that last locked the mutex, the owner. For POSIX threads, see pthread_mutex_unlock Syntax.

mutex_unlock Syntax

#include <thread.h>

int mutex_unlock(mutex_t *mp);

mutex_unlock Return Values

mutex_unlock() returns 0 if successful. When any of the following conditions is detected, mutex_unlock() fails and returns the corresponding value.



mp points to an illegal address.



The calling thread does not own the mutex.