For pthread_mutex_trylock() call on owned error-check or non-portable

adaptive mutex, return EDEADLK as required by POSIX.  The
pthread_mutex_lock() is already compliant.

Tested by:	Guy Yur <guyyur@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Approved by:	re (gjb)
This commit is contained in:
kib 2016-06-25 11:30:40 +00:00
parent e6b22eb42a
commit 75248c1348

View File

@ -850,8 +850,11 @@ mutex_self_trylock(struct pthread_mutex *m)
switch (PMUTEX_TYPE(m->m_flags)) {
case PTHREAD_MUTEX_ERRORCHECK:
case PTHREAD_MUTEX_NORMAL:
case PTHREAD_MUTEX_ADAPTIVE_NP:
ret = EDEADLK;
break;
case PTHREAD_MUTEX_NORMAL:
ret = EBUSY;
break;