diff options
author | Keith Burns (alagalah) <alagalah@gmail.com> | 2018-03-08 16:46:25 -0800 |
---|---|---|
committer | Keith Burns (alagalah) <alagalah@gmail.com> | 2018-03-08 16:46:25 -0800 |
commit | 7cf80e08b61c7c48ab834af23b3c7761634e63d2 (patch) | |
tree | f6eaf31d4718a3f460f0403a1a520848489c93d4 /src/vcl/vcl_event.c | |
parent | d77eee64b17762bf21f8dbe0b9f955513f81f1a5 (diff) |
VCL event handling changes
- added vce_get_event_handler()
- added check for event before blocking on mutex in vppcom_session_accept()
Change-Id: I8e19ea5fcbaa40279cb28152b9923ca8f1328670
Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'src/vcl/vcl_event.c')
-rw-r--r-- | src/vcl/vcl_event.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vcl/vcl_event.c b/src/vcl/vcl_event.c index 65d28707607..64f55b9fb0b 100644 --- a/src/vcl/vcl_event.c +++ b/src/vcl/vcl_event.c @@ -80,6 +80,21 @@ vce_get_event_from_index(vce_event_thread_t *evt, u32 ev_idx) } vce_event_handler_reg_t * +vce_get_event_handler (vce_event_thread_t *evt, vce_event_key_t *evk) +{ + vce_event_handler_reg_t *handler = 0; + uword *p; + + clib_spinlock_lock (&evt->handlers_lockp); + p = hash_get (evt->handlers_index_by_event_key, evk->as_u64); + if (p) + handler = pool_elt_at_index (evt->vce_event_handlers, p[0]); + clib_spinlock_unlock (&evt->handlers_lockp); + + return handler; +} + +vce_event_handler_reg_t * vce_register_handler (vce_event_thread_t *evt, vce_event_key_t *evk, vce_event_callback_t cb) { |