From: Eric Leblond Date: Wed, 5 Sep 2012 06:53:41 +0000 (+0200) Subject: affinity: add call to setup function in threads X-Git-Tag: suricata-1.4beta1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1569337a7766a796f232a5e3a623c923c94b8b4;p=thirdparty%2Fsuricata.git affinity: add call to setup function in threads Threads created through TMThreadSpawn need to call the affinity function by themselves. --- diff --git a/src/counters.c b/src/counters.c index 6ffe629a6d..0b36e26dec 100644 --- a/src/counters.c +++ b/src/counters.c @@ -446,11 +446,15 @@ static void *SCPerfMgmtThread(void *arg) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } + if (tv_local->thread_setup_flags != 0) + TmThreadSetupOptions(tv_local); + /* Set the threads capability */ tv_local->cap_flags = 0; SCDropCaps(tv_local); + if (sc_perf_op_ctx == NULL) { SCLogError(SC_ERR_PERF_STATS_NOT_INIT, "Perf Counter API not init" "SCPerfInitCounterApi() has to be called first"); @@ -507,6 +511,9 @@ static void *SCPerfWakeupThread(void *arg) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } + if (tv_local->thread_setup_flags != 0) + TmThreadSetupOptions(tv_local); + /* Set the threads capability */ tv_local->cap_flags = 0; diff --git a/src/detect-engine.c b/src/detect-engine.c index 032955d076..469f95df41 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -88,6 +88,9 @@ static void *DetectEngineLiveRuleSwap(void *arg) /* block usr2. usr2 to be handled by the main thread only */ UtilSignalBlock(SIGUSR2); + if (tv_local->thread_setup_flags != 0) + TmThreadSetupOptions(tv_local); + /* release TmThreadSpawn */ TmThreadsSetFlag(tv_local, THV_INIT_DONE); diff --git a/src/flow-manager.c b/src/flow-manager.c index 89afcfc675..95ef705a2d 100644 --- a/src/flow-manager.c +++ b/src/flow-manager.c @@ -418,6 +418,9 @@ void *FlowManagerThread(void *td) SC_PERF_TYPE_UINT64, "NULL"); + if (th_v->thread_setup_flags != 0) + TmThreadSetupOptions(th_v); + memset(&ts, 0, sizeof(ts)); FlowForceReassemblySetup();