From: Eric Leblond Date: Thu, 9 Aug 2012 14:24:18 +0000 (+0200) Subject: tm-thread: run thread init function sequentially. X-Git-Tag: suricata-1.4beta1~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f389a1201f910aa7c614c51e9af8cebcd187236a;p=thirdparty%2Fsuricata.git tm-thread: run thread init function sequentially. On some setup you want to run each thread init function sequentially. For example, if I use flow_cpu load balancing on AF_PACKET, my target is to have CPU 0 (first socket in the group) to be link with the thread 0 in detect cpu set (first thread to be initialised). A good way to achieve this is to run only one thread init function at a time to avoid any possible race condition. --- diff --git a/src/tm-threads.c b/src/tm-threads.c index 196d7dac0d..92dbcd92f8 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -1710,6 +1710,8 @@ TmEcode TmThreadSpawn(ThreadVars *tv) return TM_ECODE_FAILED; } + TmThreadWaitForFlag(tv, THV_INIT_DONE); + TmThreadAppend(tv, tv->type); return TM_ECODE_OK;