Not POSIX-conformant behaviour of pthread's mutexes
|Reported by:||daste||Owned by:||axeld|
I was trying to port some of my own stuff to Haiku, but enocuntered the following non standard behaviour in your pthread implementation (using PTHREAD_MUTEX_ERRORCHECK mutexes):
- trying to unlock a mutex before locking it causes an erroneous "mutex unlocked from foreign thread!" error message to be printed on screen and pthread_mutex_lock() returns 0 instead of EPERM;
- trying to lock a mutex for the second time in the same thread, pthread_mutex_lock() returns EBUSY instead of EDEADLK;
- EBUSY often returned by pthread_mutex_lock(), which is plain weird. pthread_mutex_lock() should just "block the thread" and cannot return EBUSY (that return value is valid only for pthread_mutex_trylock()).