svm: queue sub: Add conditional timed wait
On reviece side svm queue only permits blocking and
non-blocking calls. This patch adds timed wait blocking
functionality which returns either on signal/event or
on given time out.
It also preserves the original behavior, so it will not
hurt client applications which are using svm queue.
Change-Id: Ic10632170330a80afb8bc781d4ccddfe4da2c69a
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c
index f137223..fd2c417 100644
--- a/src/vpp-api/client/client.c
+++ b/src/vpp-api/client/client.c
@@ -143,7 +143,7 @@
q = am->vl_input_queue;
while (1)
- while (!svm_queue_sub(q, (u8 *)&msg, 0))
+ while (!svm_queue_sub(q, (u8 *)&msg, SVM_Q_WAIT, 0))
{
u16 id = ntohs(*((u16 *)msg));
switch (id) {
@@ -404,7 +404,8 @@
q = am->vl_input_queue;
again:
- rv = svm_queue_sub(q, (u8 *)&msg, 0);
+ rv = svm_queue_sub(q, (u8 *)&msg, SVM_Q_WAIT, 0);
+
if (rv == 0) {
u16 msg_id = ntohs(*((u16 *)msg));
switch (msg_id) {