diff options
author | kib <kib@FreeBSD.org> | 2016-06-25 11:30:40 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-06-25 11:30:40 +0000 |
commit | 75248c1348fc1956c29fe50cf18ddccf5b99ca30 (patch) | |
tree | 1fc4811df6d5030635930b406091e4444478a24c /lib | |
parent | e6b22eb42a51df629484f22068548ac56f8cf84e (diff) | |
download | FreeBSD-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.c | 7 |
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: |