aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@yandex-team.ru>2021-12-30 19:08:42 +0500
committerDamjan Marion <dmarion@0xa5.net>2023-03-07 11:36:47 +0000
commitd1dc1060df18fe6d00367368b150b2b90e76fd14 (patch)
tree211d3d34c0281d8b1cf9d63646948c562139781d /src/vlib
parentb7936405abd2531ed32873c8705b6474fb3f43e2 (diff)
vlib: stop worker threads on main loop exit
If not, worker threads may continue own loops after deinit and/or thread0 exit with related crashes due no rpc capability, unmapped shared memory, etc. Main loop exit handlers that uses barrier sync will be happy too as long as recursive barrier sync is supported. Type: feature Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I255a796b06936d96715683e3f062128060233dc6
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index dc21a3f2c67..95131da2f39 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -2010,7 +2010,9 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
vlib_main_loop (vm);
done:
+ /* Stop worker threads, barrier will not be released */
vlib_worker_thread_barrier_sync (vm);
+
/* Call all exit functions. */
{
clib_error_t *sub_error;
@@ -2018,7 +2020,6 @@ done:
if (sub_error)
clib_error_report (sub_error);
}
- vlib_worker_thread_barrier_release (vm);
if (error)
clib_error_report (error);