From: Matthew Smith Date: Fri, 24 May 2024 19:53:55 +0000 (+0000) Subject: vapi: only wait if queue is empty X-Git-Tag: v25.06-rc0~129 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F83%2F40983%2F2;p=vpp.git vapi: only wait if queue is empty Type: fix Fixes: 4b9935cd54 In vapi_wait(), check that the queue is empty before waiting. The condvar is only signaled on addition of the first message. pthread_cond_wait() will block approximately forever if there are already messages in the queue. Change-Id: Ic52befe443509f3c53aa9a872ba62bb05aaac25e Signed-off-by: Matthew Smith --- diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c index 61801fc3726..c818ab0bbec 100644 --- a/src/vpp-api/vapi/vapi.c +++ b/src/vpp-api/vapi/vapi.c @@ -1627,7 +1627,8 @@ vapi_wait (vapi_ctx_t ctx) return VAPI_ENOTSUP; svm_queue_lock (ctx->vl_input_queue); - svm_queue_wait (ctx->vl_input_queue); + if (ctx->vl_input_queue->cursize == 0) + svm_queue_wait (ctx->vl_input_queue); svm_queue_unlock (ctx->vl_input_queue); return VAPI_OK;