aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/svm/message_queue.h5
-rw-r--r--src/svm/queue.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 37293fc29d1..13f4d80d215 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -311,7 +311,10 @@ svm_msg_q_try_lock (svm_msg_q_t * mq)
static inline int
svm_msg_q_lock (svm_msg_q_t * mq)
{
- return pthread_mutex_lock (&mq->q->mutex);
+ int rv = pthread_mutex_lock (&mq->q->mutex);
+ if (PREDICT_FALSE (rv == EOWNERDEAD))
+ rv = pthread_mutex_consistent (&mq->q->mutex);
+ return rv;
}
/**
diff --git a/src/svm/queue.c b/src/svm/queue.c
index 8d70dda61a3..96383d44f3d 100644
--- a/src/svm/queue.c
+++ b/src/svm/queue.c
@@ -51,6 +51,8 @@ svm_queue_init (void *base, int nels, int elsize)
clib_unix_warning ("mutexattr_init");
if (pthread_mutexattr_setpshared (&attr, PTHREAD_PROCESS_SHARED))
clib_unix_warning ("pthread_mutexattr_setpshared");
+ if (pthread_mutexattr_setrobust (&attr, PTHREAD_MUTEX_ROBUST))
+ clib_unix_warning ("setrobust");
if (pthread_mutex_init (&q->mutex, &attr))
clib_unix_warning ("mutex_init");
if (pthread_mutexattr_destroy (&attr))
@@ -96,7 +98,9 @@ svm_queue_free (svm_queue_t * q)
void
svm_queue_lock (svm_queue_t * q)
{
- pthread_mutex_lock (&q->mutex);
+ int rv = pthread_mutex_lock (&q->mutex);
+ if (PREDICT_FALSE (rv == EOWNERDEAD))
+ pthread_mutex_consistent (&q->mutex);
}
void