summaryrefslogtreecommitdiffstats
path: root/src/svm/message_queue.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-12-02 07:57:00 -0800
committerDave Barach <openvpp@barachs.net>2020-12-03 16:05:27 +0000
commit1d56ac423ce25da14dce69194ceebaeda6f47f18 (patch)
tree4711975b7396a46c0c2e24a75045d455ac3deaf0 /src/svm/message_queue.h
parentd7adc293d377f4691b0285f62363c3958c68d235 (diff)
svm: fix mutex consistency on trylock
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1370943935b460a1a1a22847fed2c97b1272a5e1
Diffstat (limited to 'src/svm/message_queue.h')
-rw-r--r--src/svm/message_queue.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 13f4d80d215..d4c47d7f024 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -302,7 +302,10 @@ svm_msg_q_msg_is_invalid (svm_msg_q_msg_t * msg)
static inline int
svm_msg_q_try_lock (svm_msg_q_t * mq)
{
- return pthread_mutex_trylock (&mq->q->mutex);
+ int rv = pthread_mutex_trylock (&mq->q->mutex);
+ if (PREDICT_FALSE (rv == EOWNERDEAD))
+ rv = pthread_mutex_consistent (&mq->q->mutex);
+ return rv;
}
/**