diff options
author | Dave Barach <dave@barachs.net> | 2021-07-27 09:27:07 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-07-27 21:15:16 +0000 |
commit | 37579c3bcd5f7c31bee4d16d97cfc71dea07fb76 (patch) | |
tree | 0b46803106a69f4b1c717e7b6883869c045a0dbf /src/vlib | |
parent | 39d25e52550b0070602181b2d433d5c5306b98b8 (diff) |
vlib: don't ASSERT(vm) in worker thread bootstrap
Otherwise, threads declared with .no_data_structure_clone=1 crash on
startup.
Type: fix
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I5dcb25d1b61330fc9eee5427b815fcfcb9bf2153
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/threads.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c index a33e70ab8d4..ad677dc32b9 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -407,14 +407,16 @@ vlib_worker_thread_bootstrap_fn (void *arg) { void *rv; vlib_worker_thread_t *w = arg; + vlib_main_t *vm = 0; w->lwp = syscall (SYS_gettid); w->thread_id = pthread_self (); __os_thread_index = w - vlib_worker_threads; - vlib_process_start_switch_stack (vlib_get_main_by_index (__os_thread_index), - 0); + vm = vlib_global_main.vlib_mains[__os_thread_index]; + + vlib_process_start_switch_stack (vm, 0); rv = (void *) clib_calljmp ((uword (*)(uword)) w->thread_function, (uword) arg, w->thread_stack + VLIB_THREAD_STACK_SIZE); |