mutex互斥锁有四种属性,分别是NORMAL, ERRORCHECK, RECURSIVE, DEFAULT,通过pthread_mutexattr_settype 对互斥锁进行属性设置。
PTHREAD_MUTEX_NORMAL
This type of mutex does not detect deadlock. A thread attempting to relock this mutex without first unlocking it shall deadlock. Attempting to unlock a mutex locked by a different thread results in undefined behavior. Attempting to unlock an unlocked mutex results in undefined behavior.
PTHREAD_MUTEX_ERRORCHECK
This type of mutex provides error checking. A thread attempting to relock this mutex without first unlocking it shall return with an error. A thread attempting to unlock a mutex which another thread has locked shall return with an error. A thread attempting to unlock an unlocked mutex shall return with an error.
PTHREAD_MUTEX_RECURSIVE
A t