[...]
87 void virMutexLock(virMutexPtr m)
88 {
89 pthread_mutex_lock(&m->lock);
That is:
PTHREAD_MUTEX_NORMAL
This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking it will deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behaviour. Attempting to unlock an unlocked mutex results in undefined behaviour.
And from man pthread_mutex_lock:
If the mutex is already locked by the calling thread, the behavior of pthread_mutex_lock depends on the kind of the mutex. If the mutex is of the ``fast'' kind, the calling thread is suspended until the mutex is unlocked, thus effectively causing the calling thread to deadlock.
The post above refers to [1].
In reference to that:
virMutexInit mutexattr_ init(&attr) ; mutexattr_ settype( &attr, PTHREAD_ MUTEX_NORMAL) ; mutex_init( &m->lock, &attr);
55 pthread_mutexattr_t attr;
56 pthread_
57 pthread_
58 ret = pthread_
[...] virMutexPtr m) mutex_lock( &m->lock) ;
87 void virMutexLock(
88 {
89 pthread_
That is: MUTEX_NORMAL
PTHREAD_
This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking it will deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behaviour. Attempting to unlock an unlocked mutex results in undefined behaviour.
And from man pthread_mutex_lock:
If the mutex is already locked by the calling thread, the behavior of pthread_mutex_lock depends on the kind of the mutex. If the mutex is of the ``fast'' kind, the calling thread is suspended until the mutex is unlocked, thus effectively causing the calling thread to deadlock.
[1]: http:// paste.ubuntu. com/25438609/