summaryrefslogtreecommitdiffstats
path: root/src/vlib/unix/main.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-05-10 15:25:10 -0400
committerFlorin Coras <florin.coras@gmail.com>2019-05-14 17:50:35 +0000
commit2180baccc1428ffbd64a8312f3c983791a0771ab (patch)
treedee36722337e21f753c315768d34367531f0af1d /src/vlib/unix/main.c
parent5e8e8dcd71c619b098093e124ccde89ba3590e6f (diff)
Preallocate mhash key_tmps vector
Fix os_get_nthreads() so that it starts returning the correct answer as early as possible. Change-Id: Id5292262f2c3f521b07ffbe6a9f6748dcc4dcb7d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/unix/main.c')
-rwxr-xr-xsrc/vlib/unix/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 82de8ec7632..8c9bc1b2ce2 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -641,7 +641,7 @@ thread0 (uword arg)
u8 *
vlib_thread_stack_init (uword thread_index)
{
- vec_validate (vlib_thread_stacks, thread_index);
+ ASSERT (thread_index < vec_len (vlib_thread_stacks));
vlib_thread_stacks[thread_index] = clib_mem_alloc_aligned
(VLIB_THREAD_STACK_SIZE, clib_mem_get_page_size ());
@@ -696,6 +696,7 @@ vlib_unix_main (int argc, char *argv[])
/* always load symbols, for signal handler and mheap memory get/put backtrace */
clib_elf_main_init (vm->name);
+ vec_validate (vlib_thread_stacks, 0);
vlib_thread_stack_init (0);
__os_thread_index = 0;