aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/message_queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/svm/message_queue.c')
-rw-r--r--src/svm/message_queue.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c
index 8be6be7686f..3163d302967 100644
--- a/src/svm/message_queue.c
+++ b/src/svm/message_queue.c
@@ -498,17 +498,21 @@ svm_msg_q_wait (svm_msg_q_t *mq, svm_msg_q_wait_type_t type)
if (mq->q.evtfd == -1)
{
- rv = pthread_mutex_lock (&mq->q.shr->mutex);
- if (PREDICT_FALSE (rv == EOWNERDEAD))
+ if (type == SVM_MQ_WAIT_EMPTY)
{
- rv = pthread_mutex_consistent (&mq->q.shr->mutex);
- return rv;
+ rv = pthread_mutex_lock (&mq->q.shr->mutex);
+ if (PREDICT_FALSE (rv == EOWNERDEAD))
+ {
+ rv = pthread_mutex_consistent (&mq->q.shr->mutex);
+ return rv;
+ }
}
while (fn (mq))
pthread_cond_wait (&mq->q.shr->condvar, &mq->q.shr->mutex);
- pthread_mutex_unlock (&mq->q.shr->mutex);
+ if (type == SVM_MQ_WAIT_EMPTY)
+ pthread_mutex_unlock (&mq->q.shr->mutex);
}
else
{