summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-03-04 09:32:59 +0000
committerkib <kib@FreeBSD.org>2015-03-04 09:32:59 +0000
commitd83b961fc89abbe10456ec55724bfa50007fc4db (patch)
treef86682980797d18efaba632f789038d7f7d219d6 /lib
parentefbc02bc53bbf64ede10aad57b8138eef1036593 (diff)
downloadFreeBSD-src-d83b961fc89abbe10456ec55724bfa50007fc4db.zip
FreeBSD-src-d83b961fc89abbe10456ec55724bfa50007fc4db.tar.gz
MFC r279284:
Propagate errors from _thr_umutex_unlock2 through mutex_unlock_common.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_mutex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 61ff077..26e8776 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -633,7 +633,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer)
{
struct pthread *curthread = _get_curthread();
uint32_t id;
- int defered;
+ int defered, error;
if (__predict_false(m <= THR_MUTEX_DESTROYED)) {
if (m == THR_MUTEX_DESTROYED)
@@ -647,6 +647,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer)
if (__predict_false(m->m_owner != curthread))
return (EPERM);
+ error = 0;
id = TID(curthread);
if (__predict_false(
PMUTEX_TYPE(m->m_flags) == PTHREAD_MUTEX_RECURSIVE &&
@@ -660,7 +661,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer)
defered = 0;
DEQUEUE_MUTEX(curthread, m);
- _thr_umutex_unlock2(&m->m_lock, id, mtx_defer);
+ error = _thr_umutex_unlock2(&m->m_lock, id, mtx_defer);
if (mtx_defer == NULL && defered) {
_thr_wake_all(curthread->defer_waiters,
@@ -670,7 +671,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer)
}
if (!cv && m->m_flags & PMUTEX_FLAG_PRIVATE)
THR_CRITICAL_LEAVE(curthread);
- return (0);
+ return (error);
}
int
OpenPOWER on IntegriCloud