aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/message_queue.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-03-25 11:24:33 -0700
committerDave Barach <openvpp@barachs.net>2021-03-25 23:50:14 +0000
commit89c98a4bff101ad4270724bde7ca6f21ba4c8482 (patch)
tree95178e327777d4112e6034ebcf18bab7a0fd1001 /src/svm/message_queue.h
parent22af286a2976339b25e11c23ac273e1781138fb7 (diff)
svm: add producer wait function
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I9488ad7e045c908b60b5821d9c48583f6d513c2f
Diffstat (limited to 'src/svm/message_queue.h')
-rw-r--r--src/svm/message_queue.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/svm/message_queue.h b/src/svm/message_queue.h
index 1ef773d9f0a..0e402c5a409 100644
--- a/src/svm/message_queue.h
+++ b/src/svm/message_queue.h
@@ -399,12 +399,20 @@ svm_msg_q_unlock (svm_msg_q_t * mq)
/**
* Wait for message queue event
*
- * Must be called with mutex held. The queue only works non-blocking
- * with eventfds, so handle blocking calls as an exception here.
+ * When eventfds are not configured, the shared memory mutex is locked
+ * before waiting on the condvar. Typically called by consumers.
*/
int svm_msg_q_wait (svm_msg_q_t *mq, svm_msg_q_wait_type_t type);
/**
+ * Wait for message queue event as producer
+ *
+ * Similar to @ref svm_msg_q_wait but lock (mutex or spinlock) must
+ * be held. Should only be called by producers.
+ */
+int svm_msg_q_wait_prod (svm_msg_q_t *mq);
+
+/**
* Timed wait for message queue event
*
* Must be called with mutex held.