summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-06-25 11:30:40 +0000
committerkib <kib@FreeBSD.org>2016-06-25 11:30:40 +0000
commit75248c1348fc1956c29fe50cf18ddccf5b99ca30 (patch)
tree1fc4811df6d5030635930b406091e4444478a24c /lib
parente6b22eb42a51df629484f22068548ac56f8cf84e (diff)
downloadFreeBSD-src-75248c1348fc1956c29fe50cf18ddccf5b99ca30.zip
FreeBSD-src-75248c1348fc1956c29fe50cf18ddccf5b99ca30.tar.gz
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)
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_mutex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 5a99605..2ad05ca 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -850,9 +850,12 @@ 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 = EBUSY;
+ ret = EDEADLK;
+ break;
+
+ case PTHREAD_MUTEX_NORMAL:
+ ret = EBUSY;
break;
case PTHREAD_MUTEX_RECURSIVE:
OpenPOWER on IntegriCloud