vlib: always replace bootstrap vlib_mains
Fixes an obscure issue when spinning up pure pthreads which don't have
vlib_main_t clones.
VLIB_REGISTER_THREAD () = {
<snip>
.use_pthreads = 1,
.no_data_structure_clone = 1,
}
Type: improvement
@@ -707,16 +707,15 @@ start_workers (vlib_main_t * vm)
clib_callback_data_init (&vm->vlib_node_runtime_perf_callbacks,
&vm->worker_thread_main_loop_callback_lock);
- if (n_vlib_mains > 1)
- {
/* Replace hand-crafted length-1 vector with a real vector */
vlib_mains = 0;
- vec_validate_aligned (vlib_mains, tm->n_vlib_mains - 1,
- CLIB_CACHE_LINE_BYTES);
+ vec_validate_aligned (vlib_mains, n_vlib_mains - 1, CLIB_CACHE_LINE_BYTES);
_vec_len (vlib_mains) = 0;
vec_add1_aligned (vlib_mains, vm, CLIB_CACHE_LINE_BYTES);
+ if (n_vlib_mains > 1)
+ {
vlib_worker_threads->wait_at_barrier =
clib_mem_alloc_aligned (sizeof (u32), CLIB_CACHE_LINE_BYTES);
vlib_worker_threads->workers_at_barrier =
