suricata
tm-threads.h File Reference
#include "tmqh-packetpool.h"
#include "tm-threads-common.h"
#include "tm-modules.h"
#include "flow.h"
Include dependency graph for tm-threads.h:

Go to the source code of this file.

Data Structures

struct  TmSlot_
 

Macros

#define SleepUsec(usec)   usleep((usec))
 
#define SleepMsec(msec)   usleep((msec) * 1000)
 
#define TM_QUEUE_NAME_MAX   16
 
#define TM_THREAD_NAME_MAX   16
 

Typedefs

typedef TmEcode(* TmSlotFunc) (ThreadVars *, Packet *, void *)
 
typedef struct TmSlot_ TmSlot
 

Functions

void TmSlotSetFuncAppend (ThreadVars *, TmModule *, const void *)
 Appends a new entry to the slots. More...
 
ThreadVarsTmThreadCreate (const char *, const char *, const char *, const char *, const char *, const char *, void *(fn_p)(void *), int)
 
ThreadVarsTmThreadCreatePacketHandler (const char *, const char *, const char *, const char *, const char *, const char *)
 Creates and returns a TV instance for a Packet Processing Thread. This function doesn't support custom slots, and hence shouldn't be supplied "custom" as its slot type. All PPT threads are created with a mucond(see TmThreadCreate declaration) of 0. Hence the tv conditional variables are not used to kill the thread. More...
 
ThreadVarsTmThreadCreateMgmtThread (const char *name, void *(fn_p)(void *), int)
 Creates and returns the TV instance for a Management thread(MGMT). This function supports only custom slot functions and hence a function pointer should be sent as an argument. More...
 
ThreadVarsTmThreadCreateMgmtThreadByName (const char *name, const char *module, int mucond)
 Creates and returns the TV instance for a Management thread(MGMT). This function supports only custom slot functions and hence a function pointer should be sent as an argument. More...
 
ThreadVarsTmThreadCreateCmdThreadByName (const char *name, const char *module, int mucond)
 Creates and returns the TV instance for a Command thread (CMD). This function supports only custom slot functions and hence a function pointer should be sent as an argument. More...
 
TmEcode TmThreadSpawn (ThreadVars *)
 Spawns a thread associated with the ThreadVars instance tv. More...
 
void TmThreadKillThreadsFamily (int family)
 
void TmThreadKillThreads (void)
 
void TmThreadClearThreadsFamily (int family)
 
void TmThreadAppend (ThreadVars *, int)
 Appends this TV to tv_root based on its type. More...
 
void TmThreadSetGroupName (ThreadVars *tv, const char *name)
 
TmEcode TmThreadSetCPUAffinity (ThreadVars *, uint16_t)
 Set the thread options (cpu affinity). More...
 
TmEcode TmThreadSetThreadPriority (ThreadVars *, int)
 Set the thread options (thread priority). More...
 
TmEcode TmThreadSetCPU (ThreadVars *, uint8_t)
 
TmEcode TmThreadSetupOptions (ThreadVars *)
 Set the thread options (cpu affinitythread). Priority should be already set by pthread_create. More...
 
void TmThreadSetPrio (ThreadVars *)
 Adjusting nice value for threads. More...
 
int TmThreadGetNbThreads (uint8_t type)
 
void TmThreadInitMC (ThreadVars *)
 Initializes the mutex and condition variables for this TV. More...
 
void TmThreadContinue (ThreadVars *)
 Unpauses a thread. More...
 
void TmThreadContinueThreads (void)
 Unpauses all threads present in tv_root. More...
 
void TmThreadCheckThreadState (void)
 Used to check the thread for certain conditions of failure. More...
 
TmEcode TmThreadWaitOnThreadInit (void)
 Used to check if all threads have finished their initialization. On finding an un-initialized thread, it waits till that thread completes its initialization, before proceeding to the next thread. More...
 
int TmThreadsCheckFlag (ThreadVars *, uint32_t)
 Check if a thread flag is set. More...
 
void TmThreadsSetFlag (ThreadVars *, uint32_t)
 Set a thread flag. More...
 
void TmThreadsUnsetFlag (ThreadVars *, uint32_t)
 Unset a thread flag. More...
 
void TmThreadWaitForFlag (ThreadVars *, uint32_t)
 Waits till the specified flag(s) is(are) set. We don't bother if the kill flag has been set or not on the thread. More...
 
TmEcode TmThreadsSlotVarRun (ThreadVars *tv, Packet *p, TmSlot *slot)
 Separate run function so we can call it recursively. More...
 
void TmThreadDisablePacketThreads (void)
 Disable all packet threads. More...
 
void TmThreadDisableReceiveThreads (void)
 Disable all threads having the specified TMs. More...
 
uint32_t TmThreadCountThreadsByTmmFlags (uint8_t flags)
 returns a count of all the threads that match the flag More...
 
TmEcode TmThreadWaitOnThreadRunning (void)
 Waits for all threads to be in a running state. More...
 
TmEcode TmThreadsProcessDecodePseudoPackets (ThreadVars *tv, PacketQueueNoLock *decode_pq, TmSlot *slot)
 
void TmThreadsListThreads (void)
 
int TmThreadsRegisterThread (ThreadVars *tv, const int type)
 
void TmThreadsUnregisterThread (const int id)
 
void TmThreadsInjectFlowById (Flow *f, const int id)
 inject a flow into a threads flow queue More...
 
void TmThreadsInitThreadsTimestamp (const SCTime_t ts)
 
void TmThreadsSetThreadTimestamp (const int id, const SCTime_t ts)
 
void TmThreadsGetMinimalTimestamp (struct timeval *ts)
 
uint16_t TmThreadsGetWorkerThreadMax (void)
 
bool TmThreadsTimeSubsysIsReady (void)
 
bool TmThreadsWaitForUnpause (ThreadVars *tv)
 Wait for a thread to become unpaused. More...
 

Variables

ThreadVarstv_root [TVT_MAX]
 
SCMutex tv_root_lock
 

Detailed Description

Macro Definition Documentation

◆ SleepMsec

#define SleepMsec (   msec)    usleep((msec) * 1000)

Definition at line 46 of file tm-threads.h.

◆ SleepUsec

#define SleepUsec (   usec)    usleep((usec))

Definition at line 45 of file tm-threads.h.

◆ TM_QUEUE_NAME_MAX

#define TM_QUEUE_NAME_MAX   16

Definition at line 49 of file tm-threads.h.

◆ TM_THREAD_NAME_MAX

#define TM_THREAD_NAME_MAX   16

Definition at line 50 of file tm-threads.h.

Typedef Documentation

◆ TmSlot

typedef struct TmSlot_ TmSlot

◆ TmSlotFunc

typedef TmEcode(* TmSlotFunc) (ThreadVars *, Packet *, void *)

Definition at line 51 of file tm-threads.h.

Function Documentation

◆ TmSlotSetFuncAppend()

◆ TmThreadAppend()

void TmThreadAppend ( ThreadVars tv,
int  type 
)

Appends this TV to tv_root based on its type.

Parameters
typeholds the type this TV belongs to.

Definition at line 1160 of file tm-threads.c.

References ThreadVars_::next, SCMutexLock, SCMutexUnlock, tv, tv_root, tv_root_lock, and type.

Referenced by TmThreadSpawn().

Here is the caller graph for this function:

◆ TmThreadCheckThreadState()

void TmThreadCheckThreadState ( void  )

Used to check the thread for certain conditions of failure.

Definition at line 1924 of file tm-threads.c.

References FatalError, ThreadVars_::name, ThreadVars_::next, SCMutexLock, SCMutexUnlock, THV_FAILED, TmThreadsCheckFlag(), tv, tv_root, tv_root_lock, and TVT_MAX.

Referenced by SuricataMainLoop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadClearThreadsFamily()

void TmThreadClearThreadsFamily ( int  family)

Definition at line 1638 of file tm-threads.c.

References ThreadVars_::next, SCMutexLock, tv, tv_root, tv_root_lock, and TVT_MAX.

◆ TmThreadContinue()

void TmThreadContinue ( ThreadVars tv)

Unpauses a thread.

Parameters
tvPointer to a TV instance that has to be unpaused

Definition at line 1772 of file tm-threads.c.

References THV_PAUSE, TmThreadsUnsetFlag(), and tv.

Referenced by TmThreadContinueDetectLoaderThreads(), and TmThreadContinueThreads().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadContinueThreads()

void TmThreadContinueThreads ( void  )

Unpauses all threads present in tv_root.

Definition at line 1908 of file tm-threads.c.

References ThreadVars_::next, SCMutexLock, SCMutexUnlock, TmThreadContinue(), tv, tv_root, tv_root_lock, and TVT_MAX.

Referenced by SuricataPostInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadCountThreadsByTmmFlags()

uint32_t TmThreadCountThreadsByTmmFlags ( uint8_t  flags)

returns a count of all the threads that match the flag

Definition at line 2010 of file tm-threads.c.

References cnt, flags, ThreadVars_::next, SCMutexLock, SCMutexUnlock, ThreadVars_::tmm_flags, tv, tv_root, tv_root_lock, and TVT_MAX.

Referenced by PacketPoolPostRunmodes().

Here is the caller graph for this function:

◆ TmThreadCreate()

ThreadVars* TmThreadCreate ( const char *  ,
const char *  ,
const char *  ,
const char *  ,
const char *  ,
const char *  ,
void *  fn_p)(void *,
int   
)

◆ TmThreadCreateCmdThreadByName()

ThreadVars* TmThreadCreateCmdThreadByName ( const char *  name,
const char *  module,
int  mucond 
)

Creates and returns the TV instance for a Command thread (CMD). This function supports only custom slot functions and hence a function pointer should be sent as an argument.

Parameters
nameName of this TV instance
moduleName of TmModule with COMMAND flag set.
mucondFlag to indicate whether to initialize the condition and the mutex variables for this newly created TV.
Return values
thenewly created TV instance, or NULL on error

Definition at line 1134 of file tm-threads.c.

References ThreadVars_::id, m, MANAGEMENT_CPU_SET, TmModuleGetByName(), TmSlotSetFuncAppend(), TmThreadCreate(), TmThreadSetCPU(), TmThreadsRegisterThread(), tv, TVT_CMD, and ThreadVars_::type.

Here is the call graph for this function:

◆ TmThreadCreateMgmtThread()

ThreadVars* TmThreadCreateMgmtThread ( const char *  name,
void *  fn_p)(void *,
int  mucond 
)

Creates and returns the TV instance for a Management thread(MGMT). This function supports only custom slot functions and hence a function pointer should be sent as an argument.

Parameters
nameName of this TV instance
fn_pPointer to function when "slots" is of type "custom"
mucondFlag to indicate whether to initialize the condition and the mutex variables for this newly created TV.
Return values
thenewly created TV instance, or NULL on error

Definition at line 1073 of file tm-threads.c.

References ThreadVars_::id, MANAGEMENT_CPU_SET, TmThreadCreate(), TmThreadSetCPU(), TmThreadsRegisterThread(), tv, TVT_MGMT, and ThreadVars_::type.

Here is the call graph for this function:

◆ TmThreadCreateMgmtThreadByName()

ThreadVars* TmThreadCreateMgmtThreadByName ( const char *  name,
const char *  module,
int  mucond 
)

Creates and returns the TV instance for a Management thread(MGMT). This function supports only custom slot functions and hence a function pointer should be sent as an argument.

Parameters
nameName of this TV instance
moduleName of TmModule with MANAGEMENT flag set.
mucondFlag to indicate whether to initialize the condition and the mutex variables for this newly created TV.
Return values
thenewly created TV instance, or NULL on error

Definition at line 1101 of file tm-threads.c.

References ThreadVars_::id, m, MANAGEMENT_CPU_SET, TmModuleGetByName(), TmSlotSetFuncAppend(), TmThreadCreate(), TmThreadSetCPU(), TmThreadsRegisterThread(), tv, TVT_MGMT, and ThreadVars_::type.

Referenced by BypassedFlowManagerThreadSpawn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadCreatePacketHandler()

ThreadVars* TmThreadCreatePacketHandler ( const char *  name,
const char *  inq_name,
const char *  inqh_name,
const char *  outq_name,
const char *  outqh_name,
const char *  slots 
)

Creates and returns a TV instance for a Packet Processing Thread. This function doesn't support custom slots, and hence shouldn't be supplied "custom" as its slot type. All PPT threads are created with a mucond(see TmThreadCreate declaration) of 0. Hence the tv conditional variables are not used to kill the thread.

Parameters
nameName of this TV instance
inq_nameIncoming queue name
inqh_nameIncoming queue handler name as set by TmqhSetup()
outq_nameOutgoing queue name
outqh_nameOutgoing queue handler as set by TmqhSetup()
slotsString representation for the slot function to be used
Return values
thenewly created TV instance, or NULL on error

Definition at line 1044 of file tm-threads.c.

References ThreadVars_::id, TmThreadCreate(), TmThreadsRegisterThread(), tv, TVT_PPT, and ThreadVars_::type.

Referenced by RunModeErfFileAutoFp(), RunModeErfFileSingle(), RunModeFilePcapAutoFp(), RunModeFilePcapSingle(), RunModeSetIPSAutoFp(), RunModeSetIPSWorker(), and RunModeSetLiveCaptureAutoFp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadDisablePacketThreads()

void TmThreadDisablePacketThreads ( void  )

Disable all packet threads.

Definition at line 1487 of file tm-threads.c.

Referenced by PostRunDeinit().

Here is the caller graph for this function:

◆ TmThreadDisableReceiveThreads()

void TmThreadDisableReceiveThreads ( void  )

Disable all threads having the specified TMs.

Breaks out of the packet acquisition loop, and bumps into the 'flow loop', where it will process packets from the flow engine's shutdown handling.

Definition at line 1358 of file tm-threads.c.

References FatalError, TmModule_::flags, ThreadVars_::name, SCMutexLock, TmSlot_::slot_next, TM_FLAG_RECEIVE_TM, TmSlot_::tm_id, ThreadVars_::tm_slots, TmModuleGetById(), tv, tv_root, tv_root_lock, and TVT_PPT.

Referenced by PostRunDeinit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadGetNbThreads()

int TmThreadGetNbThreads ( uint8_t  type)

Definition at line 838 of file tm-threads.c.

References MAX_CPU_SET, ThreadsAffinityType_::nb_threads, SCLogError, thread_affinity, and type.

Referenced by RunModeErfFileAutoFp(), RunModeFilePcapAutoFp(), and TmThreadsGetWorkerThreadMax().

Here is the caller graph for this function:

◆ TmThreadInitMC()

void TmThreadInitMC ( ThreadVars tv)

Initializes the mutex and condition variables for this TV.

It can be used by a thread to control a wait loop that can also be influenced by other threads.

Parameters
tvPointer to a TV instance

Definition at line 1719 of file tm-threads.c.

References ThreadVars_::ctrl_cond, ThreadVars_::ctrl_mutex, FatalError, SCCtrlCondInit, SCCtrlMutexInit, SCMalloc, and tv.

◆ TmThreadKillThreads()

void TmThreadKillThreads ( void  )

Definition at line 1566 of file tm-threads.c.

References TmThreadKillThreadsFamily(), and TVT_MAX.

Referenced by SuricataShutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadKillThreadsFamily()

void TmThreadKillThreadsFamily ( int  family)

Definition at line 1537 of file tm-threads.c.

References BUG_ON, MIN_WAIT_TIME, SCMutexLock, tv, tv_root, tv_root_lock, and TVT_MAX.

Referenced by TmThreadKillThreads().

Here is the caller graph for this function:

◆ TmThreadsCheckFlag()

int TmThreadsCheckFlag ( ThreadVars tv,
uint32_t  flag 
)

Check if a thread flag is set.

Return values
1flag is set.
0flag is not set.

Definition at line 93 of file tm-threads.c.

References SC_ATOMIC_GET, and tv.

Referenced by FlowDisableFlowManagerThread(), TmThreadCheckThreadState(), TmThreadsWaitForUnpause(), TmThreadWaitForFlag(), and TmThreadWaitOnThreadInit().

Here is the caller graph for this function:

◆ TmThreadSetCPU()

◆ TmThreadSetCPUAffinity()

TmEcode TmThreadSetCPUAffinity ( ThreadVars tv,
uint16_t  cpu 
)

Set the thread options (cpu affinity).

Parameters
tvpointer to the ThreadVars to setup the affinity.
cpucpu on which affinity is set.
Return values
TM_ECODE_OK

Definition at line 813 of file tm-threads.c.

References ThreadVars_::cpu_affinity, THREAD_SET_AFFINITY, ThreadVars_::thread_setup_flags, TM_ECODE_OK, and tv.

Referenced by RunModeErfFileAutoFp().

Here is the caller graph for this function:

◆ TmThreadSetGroupName()

void TmThreadSetGroupName ( ThreadVars tv,
const char *  name 
)

Definition at line 1620 of file tm-threads.c.

References SCLogError, SCStrdup, ThreadVars_::thread_group_name, tv, and unlikely.

Referenced by RunModeErfFileAutoFp(), RunModeFilePcapAutoFp(), RunModeSetIPSAutoFp(), and RunModeSetLiveCaptureAutoFp().

Here is the caller graph for this function:

◆ TmThreadSetPrio()

void TmThreadSetPrio ( ThreadVars )

Adjusting nice value for threads.

Definition at line 776 of file tm-threads.c.

References ThreadVars_::name, SCEnter, SCLogDebug, SCLogError, SCReturn, ThreadVars_::thread_priority, and tv.

◆ TmThreadSetThreadPriority()

TmEcode TmThreadSetThreadPriority ( ThreadVars tv,
int  prio 
)

Set the thread options (thread priority).

Parameters
tvPointer to the ThreadVars to setup the thread priority.
Return values
TM_ECODE_OK.

Definition at line 765 of file tm-threads.c.

References ThreadVars_::thread_priority, THREAD_SET_PRIORITY, ThreadVars_::thread_setup_flags, TM_ECODE_OK, and tv.

Referenced by RunModeErfFileAutoFp().

Here is the caller graph for this function:

◆ TmThreadSetupOptions()

TmEcode TmThreadSetupOptions ( ThreadVars tv)

Set the thread options (cpu affinitythread). Priority should be already set by pthread_create.

Parameters
tvpointer to the ThreadVars of the calling thread.

Definition at line 854 of file tm-threads.c.

References ThreadVars_::cpu_affinity, ThreadVars_::name, SCGetThreadIdLong, SCLogPerf, THREAD_SET_AFFINITY, ThreadVars_::thread_setup_flags, and tv.

◆ TmThreadsGetMinimalTimestamp()

void TmThreadsGetMinimalTimestamp ( struct timeval *  ts)

Definition at line 2250 of file tm-threads.c.

References SCTIME_INITIALIZER.

◆ TmThreadsGetWorkerThreadMax()

uint16_t TmThreadsGetWorkerThreadMax ( void  )

Definition at line 2287 of file tm-threads.c.

References SCLogWarning, threading_detect_ratio, TmThreadGetNbThreads(), UtilCpuGetNumProcessorsOnline(), and WORKER_CPU_SET.

Referenced by RunModeSetIPSAutoFp(), and RunModeSetLiveCaptureAutoFp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadsInitThreadsTimestamp()

void TmThreadsInitThreadsTimestamp ( const SCTime_t  ts)

Definition at line 2234 of file tm-threads.c.

Referenced by PcapFileDispatch().

Here is the caller graph for this function:

◆ TmThreadsInjectFlowById()

void TmThreadsInjectFlowById ( Flow f,
const int  id 
)

inject a flow into a threads flow queue

Definition at line 2305 of file tm-threads.c.

References BUG_ON.

Referenced by FlowSendToLocalThread().

Here is the caller graph for this function:

◆ TmThreadsListThreads()

void TmThreadsListThreads ( void  )

Definition at line 2088 of file tm-threads.c.

References SCMutexLock.

◆ TmThreadSpawn()

TmEcode TmThreadSpawn ( ThreadVars tv)

Spawns a thread associated with the ThreadVars instance tv.

Return values
TM_ECODE_OKon success and TM_ECODE_FAILED on failure

Definition at line 1663 of file tm-threads.c.

References FatalError, SCLogDebug, ThreadVars_::t, threading_set_stack_size, THV_INIT_DONE, THV_RUNNING_DONE, TM_ECODE_OK, ThreadVars_::tm_func, TmThreadAppend(), TmThreadWaitForFlag(), tv, and ThreadVars_::type.

Referenced by BypassedFlowManagerThreadSpawn(), RunModeErfFileAutoFp(), RunModeErfFileSingle(), RunModeFilePcapAutoFp(), RunModeFilePcapSingle(), RunModeSetIPSAutoFp(), RunModeSetIPSWorker(), and RunModeSetLiveCaptureAutoFp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadsProcessDecodePseudoPackets()

TmEcode TmThreadsProcessDecodePseudoPackets ( ThreadVars tv,
PacketQueueNoLock decode_pq,
TmSlot slot 
)

Definition at line 114 of file tm-threads.c.

References DEBUG_VALIDATE_BUG_ON, Packet_::flow, PacketDequeueNoLock(), PacketQueueNoLock_::top, and unlikely.

Here is the call graph for this function:

◆ TmThreadsRegisterThread()

int TmThreadsRegisterThread ( ThreadVars tv,
const int  type 
)
Return values
idthread id, or 0 if not found

Definition at line 2112 of file tm-threads.c.

References SCMutexLock.

Referenced by TmThreadCreateCmdThreadByName(), TmThreadCreateMgmtThread(), TmThreadCreateMgmtThreadByName(), and TmThreadCreatePacketHandler().

Here is the caller graph for this function:

◆ TmThreadsSetFlag()

void TmThreadsSetFlag ( ThreadVars ,
uint32_t   
)

Set a thread flag.

Definition at line 101 of file tm-threads.c.

References SC_ATOMIC_OR, and tv.

Referenced by FlowDisableFlowManagerThread(), ReceiveErfDagLoop(), ReceiveErfFileLoop(), TmThreadCreate(), and TmThreadsWaitForUnpause().

Here is the caller graph for this function:

◆ TmThreadsSetThreadTimestamp()

void TmThreadsSetThreadTimestamp ( const int  id,
const SCTime_t  ts 
)

Definition at line 2188 of file tm-threads.c.

References SCMutexLock.

◆ TmThreadsSlotVarRun()

TmEcode TmThreadsSlotVarRun ( ThreadVars tv,
Packet p,
TmSlot slot 
)

Separate run function so we can call it recursively.

Definition at line 133 of file tm-threads.c.

References DEBUG_VALIDATE_BUG_ON, Packet_::flow, PACKET_PROFILING_TMM_END, PACKET_PROFILING_TMM_START, SC_ATOMIC_GET, TmSlot_::slot_next, TM_ECODE_FAILED, tv, and unlikely.

◆ TmThreadsTimeSubsysIsReady()

bool TmThreadsTimeSubsysIsReady ( void  )

Definition at line 2214 of file tm-threads.c.

References SCMutexLock, and SCTIME_INITIALIZER.

◆ TmThreadsUnregisterThread()

void TmThreadsUnregisterThread ( const int  id)

Definition at line 2155 of file tm-threads.c.

References SCMutexLock.

◆ TmThreadsUnsetFlag()

void TmThreadsUnsetFlag ( ThreadVars ,
uint32_t   
)

Unset a thread flag.

Definition at line 109 of file tm-threads.c.

References SC_ATOMIC_AND, and tv.

Referenced by TmThreadContinue(), and TmThreadsWaitForUnpause().

Here is the caller graph for this function:

◆ TmThreadsWaitForUnpause()

bool TmThreadsWaitForUnpause ( ThreadVars tv)

Wait for a thread to become unpaused.

Check if a thread should wait to be unpaused and wait if so, or until the thread kill flag is set.

Returns
true if the thread was unpaused, false if killed.

Also returns if the kill flag is set.

Definition at line 364 of file tm-threads.c.

References SleepUsec, THV_KILL, THV_PAUSE, THV_PAUSED, TmThreadsCheckFlag(), TmThreadsSetFlag(), TmThreadsUnsetFlag(), and tv.

Here is the call graph for this function:

◆ TmThreadWaitForFlag()

void TmThreadWaitForFlag ( ThreadVars tv,
uint32_t  flags 
)

Waits till the specified flag(s) is(are) set. We don't bother if the kill flag has been set or not on the thread.

Parameters
tvPointer to the TV instance.

Definition at line 1760 of file tm-threads.c.

References flags, SleepUsec, TmThreadsCheckFlag(), and tv.

Referenced by TmThreadSpawn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadWaitOnThreadInit()

TmEcode TmThreadWaitOnThreadInit ( void  )

Used to check if all threads have finished their initialization. On finding an un-initialized thread, it waits till that thread completes its initialization, before proceeding to the next thread.

Return values
TM_ECODE_OKall initialized properly
TM_ECODE_FAILEDfailure

Definition at line 1947 of file tm-threads.c.

References ThreadVars_::name, ThreadVars_::next, SC_ATOMIC_GET, SCLogError, SCMutexLock, SCMutexUnlock, SleepUsec, THV_CLOSED, THV_DEAD, THV_FAILED, THV_INIT_DONE, TM_ECODE_FAILED, TM_ECODE_OK, TmThreadsCheckFlag(), tv, tv_root, tv_root_lock, and TVT_MAX.

Referenced by SuricataPostInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TmThreadWaitOnThreadRunning()

TmEcode TmThreadWaitOnThreadRunning ( void  )

Waits for all threads to be in a running state.

Return values
TM_ECODE_OKif all are running or error if a thread failed

Definition at line 1839 of file tm-threads.c.

References TVT_MAX.

Referenced by SuricataPostInit().

Here is the caller graph for this function:

Variable Documentation

◆ tv_root

◆ tv_root_lock