svm: fix mutex consistency on trylock
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I1370943935b460a1a1a22847fed2c97b1272a5e1
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 13f4d80..d4c47d7 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -302,7 +302,10 @@
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;
}
/**