diff options
author | Pierre Pfister <ppfister@cisco.com> | 2021-09-10 16:38:03 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-09-14 14:42:07 +0000 |
commit | c26cc72edf195a3f57c734b5161bd37995002107 (patch) | |
tree | 04286baf62d4b505635aa63cde1809f22cc6f1ed /src/vlib/main.c | |
parent | 46e020183e3e333c67a8099c4c43c9361d7ae4af (diff) |
vlib: add graceful termination with status
This commit allows a non-VPP thread to request VPP to gracefully
shutdown and return a specific process status value.
Type: improvement
Change-Id: I9bf52b789e7ee28eb272630eaea495fd94349f79
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'src/vlib/main.c')
-rw-r--r-- | src/vlib/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c index c7c4aba3080..2f219955e70 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -2079,7 +2079,7 @@ done: if (error) clib_error_report (error); - return 0; + return vm->main_loop_exit_status; } vlib_main_t * @@ -2094,6 +2094,13 @@ vlib_get_elog_main_not_inline () return &vlib_global_main.elog_main; } +void +vlib_exit_with_status (vlib_main_t *vm, int status) +{ + vm->main_loop_exit_status = status; + __atomic_store_n (&vm->main_loop_exit_now, 1, __ATOMIC_RELEASE); +} + /* * fd.io coding-style-patch-verification: ON * |