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.
#include <thread.h> int mutex_unlock(mutex_t *mp);
mutex_unlock() returns 0 if successful. When any of the following conditions is detected, mutex_unlock() fails and returns the corresponding value.
EFAULT
Description: mp points to an illegal address.
EPERM
Description: The calling thread does not own the mutex.