diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2017-11-29 03:24:06 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-11-29 19:17:41 +0000 |
commit | 16cb408f146ad1b7fb7bbf94f746b3a1221cc9be (patch) | |
tree | 2df131144f388f628c22569be77bd0b71105e668 | |
parent | f868632b18a328c32ba43537fcc58c3ef98a75de (diff) |
VCL: drain the vpp app event queue.
Change-Id: If988b8ad33465819d0e5ab9ef92ffd69b3c7851c
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r-- | src/vcl/vppcom.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index e180967339b..7fb8e9698d8 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -2850,6 +2850,19 @@ vppcom_session_read_ready (session_t * session, u32 session_index) } } rv = ready; + + if (vcm->app_event_queue->cursize && + !pthread_mutex_trylock (&vcm->app_event_queue->mutex)) + { + u32 i, n_to_dequeue = vcm->app_event_queue->cursize; + session_fifo_event_t e; + + for (i = 0; i < n_to_dequeue; i++) + unix_shared_memory_queue_sub_raw (vcm->app_event_queue, (u8 *) & e); + + pthread_mutex_unlock (&vcm->app_event_queue->mutex); + } + done: return rv; } |