diff options
author | Matthew Smith <mgsmith@netgate.com> | 2022-12-15 22:18:08 +0000 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2023-01-04 17:00:15 +0000 |
commit | 57f177d0b7ad3002ba0d05dc8180f4b342ce5384 (patch) | |
tree | 11ac30259d982629f0a1e91fbc1902dbd03cacae /src/vpp-api/vapi/vapi.c | |
parent | 6c89a35846e6884c69f5df6a28c91dfed5b24cc8 (diff) |
vapi: add vapi_stop_rx_thread()
Type: improvement
Allow vapi to signal to an application's RX thread that it should wake
up and exit.
Before disconnecting from VPP's API, libvlibmemoryclient inserts an
rx_thread_exit message into the client's own input queue to cause its
RX thread to wake up from its blocking dequeue and exit cleanly. Add a
function to vapi's API which will allow libvapi client applications
which have an RX thread waiting for incoming messages using vapi_wait()
to do the same thing.
The existing libvlibmemoryclient code which does this was moved to a
separate function and made available for vapi_stop_rx_thread() to call.
Also fixed some inconsistencies in indentation of function prototypes in
vapi.h to make checkstyle.sh happy.
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Change-Id: I7bbb73470807123cc63ef313cfb91d1fd31b34e5
Diffstat (limited to 'src/vpp-api/vapi/vapi.c')
-rw-r--r-- | src/vpp-api/vapi/vapi.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c index 3bf56cf64cd..7700eb06d3a 100644 --- a/src/vpp-api/vapi/vapi.c +++ b/src/vpp-api/vapi/vapi.c @@ -1420,6 +1420,16 @@ vapi_get_msg_name (vapi_msg_id_t id) return __vapi_metadata.msgs[id]->name; } +void +vapi_stop_rx_thread (vapi_ctx_t ctx) +{ + if (!ctx || !ctx->connected || !ctx->vl_input_queue) + { + return; + } + + vl_client_stop_rx_thread (ctx->vl_input_queue); +} /* * fd.io coding-style-patch-verification: ON * |