suricata
threads.h File Reference
#include "suricata-common.h"
#include <pthread.h>
Include dependency graph for threads.h:

Go to the source code of this file.

Macros

#define THREAD_NAME_LEN   16
 
#define SCMutex   pthread_mutex_t
 
#define SCMutexAttr   pthread_mutexattr_t
 
#define SCMutexInit(mut, mutattr)   pthread_mutex_init(mut, mutattr)
 
#define SCMutexLock(mut)   pthread_mutex_lock(mut)
 
#define SCMutexTrylock(mut)   pthread_mutex_trylock(mut)
 
#define SCMutexUnlock(mut)   pthread_mutex_unlock(mut)
 
#define SCMutexDestroy   pthread_mutex_destroy
 
#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
 
#define SCRWLock   pthread_rwlock_t
 
#define SCRWLockInit(rwl, rwlattr)   pthread_rwlock_init(rwl, rwlattr)
 
#define SCRWLockWRLock(rwl)   pthread_rwlock_wrlock(rwl)
 
#define SCRWLockRDLock(rwl)   pthread_rwlock_rdlock(rwl)
 
#define SCRWLockTryWRLock(rwl)   pthread_rwlock_trywrlock(rwl)
 
#define SCRWLockTryRDLock(rwl)   pthread_rwlock_tryrdlock(rwl)
 
#define SCRWLockUnlock(rwl)   pthread_rwlock_unlock(rwl)
 
#define SCRWLockDestroy   pthread_rwlock_destroy
 
#define SCCondT   pthread_cond_t
 
#define SCCondInit   pthread_cond_init
 
#define SCCondSignal   pthread_cond_signal
 
#define SCCondDestroy   pthread_cond_destroy
 
#define SCCondWait(cond, mut)   pthread_cond_wait(cond, mut)
 
#define SCCtrlMutex   pthread_mutex_t
 
#define SCCtrlMutexAttr   pthread_mutexattr_t
 
#define SCCtrlMutexInit(mut, mutattr)   pthread_mutex_init(mut, mutattr)
 
#define SCCtrlMutexLock(mut)   pthread_mutex_lock(mut)
 
#define SCCtrlMutexTrylock(mut)   pthread_mutex_trylock(mut)
 
#define SCCtrlMutexUnlock(mut)   pthread_mutex_unlock(mut)
 
#define SCCtrlMutexDestroy   pthread_mutex_destroy
 
#define SCCtrlCondT   pthread_cond_t
 
#define SCCtrlCondInit   pthread_cond_init
 
#define SCCtrlCondSignal   pthread_cond_signal
 
#define SCCtrlCondTimedwait   pthread_cond_timedwait
 
#define SCCtrlCondWait   pthread_cond_wait
 
#define SCCtrlCondDestroy   pthread_cond_destroy
 
#define SCSpinlock   SCMutex
 
#define SCSpinLock(spin)   SCMutexLock((spin))
 
#define SCSpinTrylock(spin)   SCMutexTrylock((spin))
 
#define SCSpinUnlock(spin)   SCMutexUnlock((spin))
 
#define SCSpinInit(spin, spin_attr)   SCMutexInit((spin), NULL)
 
#define SCSpinDestroy(spin)   SCMutexDestroy((spin))
 
#define SCGetThreadIdLong(...)
 
#define SCSetThreadName(n)
 

Enumerations

enum  { PRIO_LOW = 2, PRIO_MEDIUM = 0, PRIO_HIGH = -2 }
 

Functions

void ThreadMacrosRegisterTests (void)
 this function registers unit tests for DetectId More...
 

Variables

thread_local char t_thread_name [THREAD_NAME_LEN+1]
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t
Pablo Rincon Crespo pablo.nosp@m..rin.nosp@m.con.c.nosp@m.resp.nosp@m.o@gma.nosp@m.il.c.nosp@m.om

Threading functions defined as macros

Definition in file threads.h.

Macro Definition Documentation

◆ SCCondDestroy

#define SCCondDestroy   pthread_cond_destroy

Definition at line 140 of file threads.h.

◆ SCCondInit

#define SCCondInit   pthread_cond_init

Definition at line 138 of file threads.h.

◆ SCCondSignal

#define SCCondSignal   pthread_cond_signal

Definition at line 139 of file threads.h.

◆ SCCondT

#define SCCondT   pthread_cond_t

Definition at line 137 of file threads.h.

◆ SCCondWait

#define SCCondWait (   cond,
  mut 
)    pthread_cond_wait(cond, mut)

Definition at line 141 of file threads.h.

◆ SCCtrlCondDestroy

#define SCCtrlCondDestroy   pthread_cond_destroy

Definition at line 158 of file threads.h.

◆ SCCtrlCondInit

#define SCCtrlCondInit   pthread_cond_init

Definition at line 154 of file threads.h.

◆ SCCtrlCondSignal

#define SCCtrlCondSignal   pthread_cond_signal

Definition at line 155 of file threads.h.

◆ SCCtrlCondT

#define SCCtrlCondT   pthread_cond_t

Definition at line 153 of file threads.h.

◆ SCCtrlCondTimedwait

#define SCCtrlCondTimedwait   pthread_cond_timedwait

Definition at line 156 of file threads.h.

◆ SCCtrlCondWait

#define SCCtrlCondWait   pthread_cond_wait

Definition at line 157 of file threads.h.

◆ SCCtrlMutex

#define SCCtrlMutex   pthread_mutex_t

Definition at line 144 of file threads.h.

◆ SCCtrlMutexAttr

#define SCCtrlMutexAttr   pthread_mutexattr_t

Definition at line 145 of file threads.h.

◆ SCCtrlMutexDestroy

#define SCCtrlMutexDestroy   pthread_mutex_destroy

Definition at line 150 of file threads.h.

◆ SCCtrlMutexInit

#define SCCtrlMutexInit (   mut,
  mutattr 
)    pthread_mutex_init(mut, mutattr)

Definition at line 146 of file threads.h.

◆ SCCtrlMutexLock

#define SCCtrlMutexLock (   mut)    pthread_mutex_lock(mut)

Definition at line 147 of file threads.h.

◆ SCCtrlMutexTrylock

#define SCCtrlMutexTrylock (   mut)    pthread_mutex_trylock(mut)

Definition at line 148 of file threads.h.

◆ SCCtrlMutexUnlock

#define SCCtrlMutexUnlock (   mut)    pthread_mutex_unlock(mut)

Definition at line 149 of file threads.h.

◆ SCGetThreadIdLong

#define SCGetThreadIdLong (   ...)
Value:
({ \
pid_t tmpthid; \
tmpthid = syscall(SYS_gettid); \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})

Get the Current Thread Id

Definition at line 256 of file threads.h.

◆ SCMutex

#define SCMutex   pthread_mutex_t

Definition at line 117 of file threads.h.

◆ SCMUTEX_INITIALIZER

#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER

Definition at line 124 of file threads.h.

◆ SCMutexAttr

#define SCMutexAttr   pthread_mutexattr_t

Definition at line 118 of file threads.h.

◆ SCMutexDestroy

#define SCMutexDestroy   pthread_mutex_destroy

Definition at line 123 of file threads.h.

◆ SCMutexInit

#define SCMutexInit (   mut,
  mutattr 
)    pthread_mutex_init(mut, mutattr)

Definition at line 119 of file threads.h.

◆ SCMutexLock

#define SCMutexLock (   mut)    pthread_mutex_lock(mut)

Definition at line 120 of file threads.h.

◆ SCMutexTrylock

#define SCMutexTrylock (   mut)    pthread_mutex_trylock(mut)

Definition at line 121 of file threads.h.

◆ SCMutexUnlock

#define SCMutexUnlock (   mut)    pthread_mutex_unlock(mut)

Definition at line 122 of file threads.h.

◆ SCRWLock

#define SCRWLock   pthread_rwlock_t

Definition at line 127 of file threads.h.

◆ SCRWLockDestroy

#define SCRWLockDestroy   pthread_rwlock_destroy

Definition at line 134 of file threads.h.

◆ SCRWLockInit

#define SCRWLockInit (   rwl,
  rwlattr 
)    pthread_rwlock_init(rwl, rwlattr)

Definition at line 128 of file threads.h.

◆ SCRWLockRDLock

#define SCRWLockRDLock (   rwl)    pthread_rwlock_rdlock(rwl)

Definition at line 130 of file threads.h.

◆ SCRWLockTryRDLock

#define SCRWLockTryRDLock (   rwl)    pthread_rwlock_tryrdlock(rwl)

Definition at line 132 of file threads.h.

◆ SCRWLockTryWRLock

#define SCRWLockTryWRLock (   rwl)    pthread_rwlock_trywrlock(rwl)

Definition at line 131 of file threads.h.

◆ SCRWLockUnlock

#define SCRWLockUnlock (   rwl)    pthread_rwlock_unlock(rwl)

Definition at line 133 of file threads.h.

◆ SCRWLockWRLock

#define SCRWLockWRLock (   rwl)    pthread_rwlock_wrlock(rwl)

Definition at line 129 of file threads.h.

◆ SCSetThreadName

#define SCSetThreadName (   n)
Value:
({ \
strlcpy(t_thread_name, n, sizeof(t_thread_name)); \
}

Definition at line 304 of file threads.h.

◆ SCSpinDestroy

#define SCSpinDestroy (   spin)    SCMutexDestroy((spin))

Definition at line 167 of file threads.h.

◆ SCSpinInit

#define SCSpinInit (   spin,
  spin_attr 
)    SCMutexInit((spin), NULL)

Definition at line 166 of file threads.h.

◆ SCSpinlock

#define SCSpinlock   SCMutex

Definition at line 162 of file threads.h.

◆ SCSpinLock

#define SCSpinLock (   spin)    SCMutexLock((spin))

Definition at line 163 of file threads.h.

◆ SCSpinTrylock

#define SCSpinTrylock (   spin)    SCMutexTrylock((spin))

Definition at line 164 of file threads.h.

◆ SCSpinUnlock

#define SCSpinUnlock (   spin)    SCMutexUnlock((spin))

Definition at line 165 of file threads.h.

◆ THREAD_NAME_LEN

#define THREAD_NAME_LEN   16

Definition at line 34 of file threads.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PRIO_LOW 
PRIO_MEDIUM 
PRIO_HIGH 

Definition at line 87 of file threads.h.

Function Documentation

◆ ThreadMacrosRegisterTests()

void ThreadMacrosRegisterTests ( void  )

this function registers unit tests for DetectId

Definition at line 145 of file threads.c.

References UtRegisterTest().

Here is the call graph for this function:

Variable Documentation

◆ t_thread_name

thread_local char t_thread_name[THREAD_NAME_LEN+1]

Definition at line 33 of file threads.c.

t_thread_name
thread_local char t_thread_name[THREAD_NAME_LEN+1]
Definition: threads.c:33