Locks the specified mutex.
#include <pthread.h> int pthread_mutex_lock ( pthread_mutex_t *mutex);
(IN) Points to the mutex to lock. It is expected that the hierarchy value of this mutex is greater than any of the mutexes that might be currently held by this thread. (For a discussion on lock hierarchy, see pthread_mutex_init.)
If successful, returns 0; otherwise returns a nonzero error code:
The thread_mutex_lock function acquires the specified mutually exclusive lock. If the lock being acquired is not free (is held by a different thread), the calling thread waits until the lock can be acquired. No assumptions can be made about the way the calling thread might wait for the lock to become free. The mutex is not guaranteed to be FIFO.