diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2018-01-04 18:57:26 +0100 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-22 18:17:23 +0000 |
commit | 3fca567ff438145e28dd1318ad5b1734c1091257 (patch) | |
tree | 7101b4ae130f2731e549f82ab98af8bfbabc6571 /src/vpp-api/client/client.c | |
parent | e82488f10f20f464961c5c7b381b4a419bca0bbc (diff) |
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>
Diffstat (limited to 'src/vpp-api/client/client.c')
-rw-r--r-- | src/vpp-api/client/client.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c index f1372230195..fd2c4174285 100644 --- a/src/vpp-api/client/client.c +++ b/src/vpp-api/client/client.c @@ -143,7 +143,7 @@ vac_rx_thread_fn (void *arg) 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 @@ vac_read (char **p, int *l, u16 timeout) 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) { |