diff options
author | Dave Barach <dbarach@cisco.com> | 2017-09-26 10:54:34 -0400 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2017-09-26 17:17:09 +0000 |
commit | 69128d0209ba6108430dca9cc78ab36a9b1c793e (patch) | |
tree | 744b543327338d10594c2578f66ec250d3947070 /src/vlib/node_funcs.h | |
parent | 8a398bbae279f07b1f9203721836b60dd1f39142 (diff) |
Add thread-safe event signaller, use RPC where required
Update ping code to use the new function
Change-Id: Ieb753b23f8402cbe5667c22747896784c8ece937
Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/node_funcs.h')
-rw-r--r-- | src/vlib/node_funcs.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h index 3ae4e541a68..0734476cb8f 100644 --- a/src/vlib/node_funcs.h +++ b/src/vlib/node_funcs.h @@ -965,6 +965,29 @@ vlib_process_signal_event_pointer (vlib_main_t * vm, d[0] = data; } +/** + * Signal event to process from any thread. + * + * When in doubt, use this. + */ +always_inline void +vlib_process_signal_event_mt (vlib_main_t * vm, + uword node_index, uword type_opaque, uword data) +{ + if (vlib_get_thread_index () != 0) + { + vlib_process_signal_event_mt_args_t args = { + .node_index = node_index, + .type_opaque = type_opaque, + .data = data, + }; + vlib_rpc_call_main_thread (vlib_process_signal_event_mt_helper, + (u8 *) & args, sizeof (args)); + } + else + vlib_process_signal_event (vm, node_index, type_opaque, data); +} + always_inline void vlib_process_signal_one_time_event (vlib_main_t * vm, uword node_index, |