summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr/thread/thr_mutex.c')
-rw-r--r--lib/libthr/thread/thr_mutex.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 12ff1df..a83454a 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -636,6 +636,12 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, int *count)
struct pthread_mutex *m;
m = *mutex;
+ if (__predict_false(m <= THR_MUTEX_DESTROYED)) {
+ if (m == THR_MUTEX_DESTROYED)
+ return (EINVAL);
+ return (EPERM);
+ }
+
/*
* Check if the running thread is not the owner of the mutex.
*/
OpenPOWER on IntegriCloud