delete_mutex - delete a mutex
mutex_lock - lock a mutex
mutex_unlock - unlock a mutex
mutex_p new_mutex(void);
void delete_mutex(mutex_p mp);
void mutex_lock(mutex_p mp);
void mutex_unlock(mutex_p mp);
new_mutex() allocates a new mutex lock and initializes it to be released.
delete_mutex() deletes a mutex lock that has been allocated by new_mutex().
mutex_lock() tries to lock the mutex. If it is already locked, the calling thread will be blocked until the lock will be released. Then it retries to set the lock again.
mutex_unlock() unlocks the mutex. If there are threads waiting for the lock to be released, one of them will be waked up. It's not garanteed that this thread will be able to aquire the lock as another thread might have locked it until the waked up thread has actually been scheduled.