From f034105173fd149758c436d77eb2452a3f735299 Mon Sep 17 00:00:00 2001 From: Christian Giese Date: Fri, 14 Oct 2022 18:56:29 +0200 Subject: [PATCH] add some time between thread creation --- code/bngblaster/src/io/io_thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/bngblaster/src/io/io_thread.c b/code/bngblaster/src/io/io_thread.c index a5e1a86a..597f7dff 100644 --- a/code/bngblaster/src/io/io_thread.c +++ b/code/bngblaster/src/io/io_thread.c @@ -285,10 +285,14 @@ void io_thread_start_all() { io_thread_s *thread = g_ctx->io_threads; + struct timespec sleep, rem; + + sleep.tv_nsec = 7800179; /* prime number betwen 7 and 8ms */ while(thread) { thread->active = true; timer_smear_all_buckets(&thread->timer.root); pthread_create(&thread->thread, NULL, io_thread_main, (void *)thread); + nanosleep(&sleep, &rem); thread = thread->next; } }