From 4b9935cd54e5ca31c192cb9113e3056016f0b728 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Fri, 2 Dec 2022 20:46:16 +0000 Subject: vapi: implement vapi_wait() for reads Type: improvement The function vapi_wait() is intended to allow a caller to block while waiting until the API queue can be read/written. It was a stub that returned VAPI_ENOTSUP. Add code which implements the wait on being able to read an incoming message. Had to touch a few other things in vapi.h to make checkstyle.sh happy after changing the prototype of vapi_wait(). Signed-off-by: Matthew Smith Change-Id: Ida80c1a1d34fe297ab23268087be65ea53ad7040 --- src/vpp-api/vapi/vapi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/vpp-api/vapi/vapi.c') diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c index 7808bec8521..25571dcb54a 100644 --- a/src/vpp-api/vapi/vapi.c +++ b/src/vpp-api/vapi/vapi.c @@ -989,9 +989,13 @@ again: } vapi_error_e -vapi_wait (vapi_ctx_t ctx, vapi_wait_mode_e mode) +vapi_wait (vapi_ctx_t ctx) { - return VAPI_ENOTSUP; + svm_queue_lock (ctx->vl_input_queue); + svm_queue_wait (ctx->vl_input_queue); + svm_queue_unlock (ctx->vl_input_queue); + + return VAPI_OK; } static vapi_error_e -- cgit 1.2.3-korg