suricata
threads-debug.h File Reference

Go to the source code of this file.

Macros

#define SCMutexLock_dbg(mut)
 
#define SCMutexTrylock_dbg(mut)
 
#define SCMutexInit_dbg(mut, mutattr)
 
#define SCMutexUnlock_dbg(mut)
 
#define SCMutex   pthread_mutex_t
 
#define SCMutexAttr   pthread_mutexattr_t
 
#define SCMutexInit(mut, mutattrs)   SCMutexInit_dbg(mut, mutattrs)
 
#define SCMutexLock(mut)   SCMutexLock_dbg(mut)
 
#define SCMutexTrylock(mut)   SCMutexTrylock_dbg(mut)
 
#define SCMutexUnlock(mut)   SCMutexUnlock_dbg(mut)
 
#define SCMutexDestroy   pthread_mutex_destroy
 
#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
 
#define SCCondWait_dbg(cond, mut)
 
#define SCCondT   pthread_cond_t
 
#define SCCondInit   pthread_cond_init
 
#define SCCondSignal   pthread_cond_signal
 
#define SCCondDestroy   pthread_cond_destroy
 
#define SCCondWait   SCCondWait_dbg
 
#define SCSpinLock_dbg(spin)
 
#define SCSpinTrylock_dbg(spin)
 
#define SCSpinUnlock_dbg(spin)
 
#define SCSpinInit_dbg(spin, spin_attr)
 
#define SCSpinDestroy_dbg(spin)
 
#define SCSpinlock   pthread_spinlock_t
 
#define SCSpinLock   SCSpinLock_dbg
 
#define SCSpinTrylock   SCSpinTrylock_dbg
 
#define SCSpinUnlock   SCSpinUnlock_dbg
 
#define SCSpinInit   SCSpinInit_dbg
 
#define SCSpinDestroy   SCSpinDestroy_dbg
 
#define SCRWLockRDLock_dbg(rwl)
 
#define SCRWLockWRLock_dbg(rwl)
 
#define SCRWLockTryWRLock_dbg(rwl)
 
#define SCRWLockTryRDLock_dbg(rwl)
 
#define SCRWLockInit_dbg(rwl, rwlattr)
 
#define SCRWLockUnlock_dbg(rwl)
 
#define SCRWLock   pthread_rwlock_t
 
#define SCRWLockInit(rwl, rwlattrs)   SCRWLockInit_dbg(rwl, rwlattrs)
 
#define SCRWLockRDLock(rwl)   SCRWLockRDLock_dbg(rwl)
 
#define SCRWLockWRLock(rwl)   SCRWLockWRLock_dbg(rwl)
 
#define SCRWLockTryWRLock(rwl)   SCRWLockTryWRLock_dbg(rwl)
 
#define SCRWLockTryRDLock(rwl)   SCRWLockTryRDLock_dbg(rwl)
 
#define SCRWLockUnlock(rwl)   SCRWLockUnlock_dbg(rwl)
 
#define SCRWLockDestroy   pthread_rwlock_destroy
 
#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
 

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: debug variants

Definition in file threads-debug.h.

Macro Definition Documentation

#define SCCondDestroy   pthread_cond_destroy

Definition at line 140 of file threads-debug.h.

#define SCCondInit   pthread_cond_init

Definition at line 138 of file threads-debug.h.

Referenced by GlobalsInitPreConfig(), PacketPoolInit(), and PacketPoolInitEmpty().

#define SCCondT   pthread_cond_t

Definition at line 137 of file threads-debug.h.

#define SCCondWait   SCCondWait_dbg
#define SCCondWait_dbg (   cond,
  mut 
)
Value:
({ \
int ret = pthread_cond_wait(cond, mut); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid (or a SCCondT not initialized!)\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") failed SCCondWait %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, ret); \
break; \
} \
ret; \
})
SCCondT cond

Definition at line 125 of file threads-debug.h.

#define SCCtrlCondDestroy   pthread_cond_destroy

Definition at line 387 of file threads-debug.h.

Referenced by TmThreadInitMC().

#define SCCtrlCondInit   pthread_cond_init
#define SCCtrlCondSignal   pthread_cond_signal

Definition at line 384 of file threads-debug.h.

Referenced by FlowDisableFlowManagerThread(), and FlowDisableFlowRecyclerThread().

#define SCCtrlCondT   pthread_cond_t

Definition at line 382 of file threads-debug.h.

#define SCCtrlCondTimedwait   pthread_cond_timedwait

Definition at line 385 of file threads-debug.h.

Referenced by StatsSetUI64().

#define SCCtrlCondWait   pthread_cond_wait

Definition at line 386 of file threads-debug.h.

#define SCCtrlMutex   pthread_mutex_t

Definition at line 373 of file threads-debug.h.

Referenced by RunModeUnixSocketGetDefaultMode().

#define SCCtrlMutexAttr   pthread_mutexattr_t

Definition at line 374 of file threads-debug.h.

#define SCCtrlMutexDestroy   pthread_mutex_destroy

Definition at line 379 of file threads-debug.h.

Referenced by TmThreadInitMC().

#define SCCtrlMutexInit (   mut,
  mutattr 
)    pthread_mutex_init(mut, mutattr)
#define SCCtrlMutexLock (   mut)    pthread_mutex_lock(mut)
#define SCCtrlMutexTrylock (   mut)    pthread_mutex_trylock(mut)

Definition at line 377 of file threads-debug.h.

#define SCCtrlMutexUnlock (   mut)    pthread_mutex_unlock(mut)
#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
#define SCMutexAttr   pthread_mutexattr_t

Definition at line 115 of file threads-debug.h.

#define SCMutexInit_dbg (   mut,
  mutattr 
)
Value:
({ \
int ret; \
ret = pthread_mutex_init(mut, mutattr); \
if (ret != 0) { \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") mutex %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, ret); \
break; \
case EAGAIN: \
printf("The system temporarily lacks the resources to create another mutex\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") mutex %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, ret); \
break; \
case ENOMEM: \
printf("The process cannot allocate enough memory to create another mutex\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") mutex %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, ret); \
break; \
} \
} \
ret; \
})

Definition at line 75 of file threads-debug.h.

#define SCMutexLock (   mut)    SCMutexLock_dbg(mut)

Definition at line 117 of file threads-debug.h.

Referenced by AffinityGetNextCPU(), AppLayerHtpPrintStats(), DecodeRegisterPerfCounters(), DecodeUnregisterCounters(), DefragGetTrackerFromHash(), DefragLookupTrackerFromHash(), DefragRbFragCompare(), DefragTrackerFreeFrags(), DetectDNP3Register(), DetectEngineAddToMaster(), DetectEngineBumpVersion(), DetectEngineEnabled(), DetectEngineGetByTenantId(), DetectEngineGetCurrent(), DetectEngineGetVersion(), DetectEngineInspectBufferGeneric(), DetectEngineMoveToFreeList(), DetectEngineMTApply(), DetectEngineMultiTenantSetup(), DetectEnginePruneFreeList(), DetectEngineReloadIsIdle(), DetectEngineReloadIsStart(), DetectEngineReloadSetIdle(), DetectEngineReloadStart(), DetectFlowbitsAnalyze(), DetectLoaderQueueTask(), DetectLoadersSync(), DetectMarkDataFree(), EngineAnalysisRulesFailure(), FlowDisableFlowManagerThread(), FlowDisableFlowRecyclerThread(), FTPAtExitPrintStats(), HostGetHostFromHash(), HostLock(), HostLookupHostFromHash(), HTPAtExitPrintStats(), HTPStateFree(), IPFWRegisterQueue(), IPPairCleanup(), IPPairGetIPPairFromHash(), IPPairLock(), IPPairLookupIPPairFromHash(), LogFileFreeCtx(), LogFileWrite(), NFQRegisterQueue(), NoWinDivertSupportExit(), OutputRegisterFiledataLogger(), PacketAlertThreshold(), PacketPoolReturnPacket(), PacketPoolWait(), PacketPoolWaitForN(), PacketProfileLoggertIdToString(), PoolThreadFree(), PoolThreadGetById(), PoolThreadGrow(), PoolThreadInit(), PoolThreadReturn(), ReceiveNFQThreadInit(), ReceivePcapThreadInit(), ReceivePfringThreadInit(), RegisterDNP3Parsers(), SCBPFCompile(), SCLogAddFDFilter(), SCLogCheckFDFilterEntry(), SCLogCheckFDFilterExit(), SCLogMatchFDFilter(), SCLogMessage(), SCLogPrintFDFilters(), SCLogPrintFGFilters(), SCLogReleaseFDFilters(), SCLogReleaseFGFilters(), SCLogRemoveFDFilter(), StatsSetUI64(), StatsUpdateCounterArray(), StreamTcpFreeConfig(), StreamTcpInitConfig(), StreamTcpReassembleFree(), StreamTcpReassembleGetMemcap(), StreamTcpReassembleInitThreadCtx(), StreamTcpSessionClear(), StreamTcpThreadInit(), TmModuleDecodeAFPRegister(), TmModuleDecodeIPFWRegister(), TmModuleDecodeNetmapRegister(), TmqDebugList(), TmqhInputFlow(), TmqhInputSimple(), TmqhOutputFlowHash(), TmqhOutputFlowIPPair(), TmqhOutputPacketpool(), TmqhOutputSimple(), TmqhOutputVerdictNfq(), TmreadsGetMinimalTimestamp(), TmSlotGetSlotForTM(), TmThreadAppend(), TmThreadCheckThreadState(), TmThreadClearThreadsFamily(), TmThreadContinueDetectLoaderThreads(), TmThreadContinueThreads(), TmThreadCountThreadsByTmmFlags(), TmThreadDisablePacketThreads(), TmThreadDisableReceiveThreads(), TmThreadGetFirstTmSlotForPartialPattern(), TmThreadKillThreadsFamily(), TmThreadPauseThreads(), TmThreadRemove(), TmThreadsGetCallingThread(), TmThreadsGetTVContainingSlot(), TmThreadsInjectPacketsById(), TmThreadsListThreads(), TmThreadsRegisterThread(), TmThreadsSetThreadTimestamp(), TmThreadsSlotVarRun(), TmThreadsUnregisterThread(), TmThreadWaitOnThreadInit(), TmThreadWakeupDetectLoaderThreads(), TmValidateQueueState(), VarNameStoreActivateStaging(), VarNameStoreFree(), VarNameStoreFreeOld(), VarNameStoreSetupAdd(), VarNameStoreSetupLookup(), and VarNameStoreSetupStaging().

#define SCMutexLock_dbg (   mut)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locking mutex %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut); \
int retl = pthread_mutex_lock(mut); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locked mutex %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, retl); \
if (retl != 0) { \
switch (retl) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
retl = pthread_mutex_init(mut, NULL); \
if (retl != 0) \
exit(EXIT_FAILURE); \
retl = pthread_mutex_lock(mut); \
break; \
case EDEADLK: \
printf("A deadlock would occur if the thread blocked waiting for mutex\n"); \
break; \
} \
} \
retl; \
})

When dbg threads is defined, if a mutex fail to lock, it's initialized, logged, and does a second try; This is to prevent the system to freeze; It is for Mac OS X users; If you see a mutex, spinlock or condiion not initialized, report it please!

Definition at line 37 of file threads-debug.h.

#define SCMutexTrylock_dbg (   mut)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocking mutex %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut); \
int rett = pthread_mutex_trylock(mut); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocked mutex %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, rett); \
if (rett != 0) { \
switch (rett) { \
case EINVAL: \
printf("%16s(%s:%d): The value specified by attr is invalid\n", __FUNCTION__, __FILE__, __LINE__); \
break; \
case EBUSY: \
printf("Mutex is already locked\n"); \
break; \
} \
} \
rett; \
})

Definition at line 58 of file threads-debug.h.

#define SCMutexUnlock (   mut)    SCMutexUnlock_dbg(mut)

Definition at line 119 of file threads-debug.h.

Referenced by AffinityGetNextCPU(), AppLayerHtpPrintStats(), DecodeRegisterPerfCounters(), DecodeUnregisterCounters(), DefragLookupTrackerFromHash(), DefragRbFragCompare(), DefragTrackerFreeFrags(), DefragTrackerRelease(), DetectDNP3Register(), DetectEngineAddToMaster(), DetectEngineBumpVersion(), DetectEngineEnabled(), DetectEngineGetByTenantId(), DetectEngineGetCurrent(), DetectEngineGetVersion(), DetectEngineInspectBufferGeneric(), DetectEngineMoveToFreeList(), DetectEngineMTApply(), DetectEngineMultiTenantSetup(), DetectEnginePruneFreeList(), DetectEngineReloadIsIdle(), DetectEngineReloadIsStart(), DetectEngineReloadSetIdle(), DetectEngineReloadStart(), DetectFlowbitsAnalyze(), DetectLoaderQueueTask(), DetectLoadersSync(), DetectMarkDataFree(), EngineAnalysisRulesFailure(), FlowDisableFlowManagerThread(), FlowDisableFlowRecyclerThread(), FTPAtExitPrintStats(), HostGetActiveCount(), HostLookupHostFromHash(), HostRelease(), HostUnlock(), HTPAtExitPrintStats(), HTPStateFree(), IPFWRegisterQueue(), IPPairGetActiveCount(), IPPairLookupIPPairFromHash(), IPPairRelease(), IPPairUnlock(), LogFileFreeCtx(), LogFileWrite(), NFQRegisterQueue(), NoWinDivertSupportExit(), OutputRegisterFiledataLogger(), PacketAlertThreshold(), PacketPoolReturnPacket(), PacketPoolWait(), PacketPoolWaitForN(), PacketProfileLoggertIdToString(), PoolThreadFree(), PoolThreadGetById(), PoolThreadGrow(), PoolThreadInit(), PoolThreadReturn(), ReceiveNFQThreadInit(), ReceivePcapThreadInit(), ReceivePfringThreadInit(), RegisterDNP3Parsers(), SCBPFCompile(), SCLogAddFDFilter(), SCLogCheckFDFilterEntry(), SCLogCheckFDFilterExit(), SCLogMatchFDFilter(), SCLogMessage(), SCLogPrintFDFilters(), SCLogPrintFGFilters(), SCLogReleaseFDFilters(), SCLogReleaseFGFilters(), SCLogRemoveFDFilter(), StatsSetUI64(), StatsUpdateCounterArray(), StreamTcpFreeConfig(), StreamTcpInitConfig(), StreamTcpReassembleFree(), StreamTcpReassembleGetMemcap(), StreamTcpReassembleInitThreadCtx(), StreamTcpSessionClear(), StreamTcpThreadInit(), TmModuleDecodeAFPRegister(), TmModuleDecodeIPFWRegister(), TmModuleDecodeNetmapRegister(), TmqDebugList(), TmqhInputFlow(), TmqhInputSimple(), TmqhOutputFlowHash(), TmqhOutputFlowIPPair(), TmqhOutputPacketpool(), TmqhOutputSimple(), TmqhOutputVerdictNfq(), TmreadsGetMinimalTimestamp(), TmSlotGetSlotForTM(), TmThreadAppend(), TmThreadCheckThreadState(), TmThreadClearThreadsFamily(), TmThreadContinueDetectLoaderThreads(), TmThreadContinueThreads(), TmThreadCountThreadsByTmmFlags(), TmThreadDisablePacketThreads(), TmThreadDisableReceiveThreads(), TmThreadGetFirstTmSlotForPartialPattern(), TmThreadKillThreadsFamily(), TmThreadPauseThreads(), TmThreadRemove(), TmThreadsGetCallingThread(), TmThreadsGetTVContainingSlot(), TmThreadsInjectPacketsById(), TmThreadsListThreads(), TmThreadsRegisterThread(), TmThreadsSetThreadTimestamp(), TmThreadsSlotVarRun(), TmThreadsUnregisterThread(), TmThreadWaitOnThreadInit(), TmThreadWakeupDetectLoaderThreads(), TmValidateQueueState(), VarNameStoreActivateStaging(), VarNameStoreFree(), VarNameStoreFreeOld(), VarNameStoreSetupAdd(), VarNameStoreSetupLookup(), and VarNameStoreSetupStaging().

#define SCMutexUnlock_dbg (   mut)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocking mutex %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut); \
int retu = pthread_mutex_unlock(mut); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocked mutex %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), mut, retu); \
if (retu != 0) { \
switch (retu) { \
case EINVAL: \
printf("%16s(%s:%d): The value specified by attr is invalid\n", __FUNCTION__, __FILE__, __LINE__); \
break; \
case EPERM: \
printf("The current thread does not hold a lock on mutex\n"); \
break; \
} \
} \
retu; \
})

Definition at line 97 of file threads-debug.h.

#define SCRWLock   pthread_rwlock_t

Definition at line 363 of file threads-debug.h.

#define SCRWLockDestroy   pthread_rwlock_destroy

Definition at line 370 of file threads-debug.h.

#define SCRWLockInit (   rwl,
  rwlattrs 
)    SCRWLockInit_dbg(rwl, rwlattrs)

Definition at line 364 of file threads-debug.h.

#define SCRWLockInit_dbg (   rwl,
  rwlattr 
)
Value:
({ \
int ret; \
ret = pthread_rwlock_init(rwl, rwlattr); \
if (ret != 0) { \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") rwlock %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, ret); \
break; \
case EAGAIN: \
printf("The system temporarily lacks the resources to create another rwlock\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") rwlock %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, ret); \
break; \
case ENOMEM: \
printf("The process cannot allocate enough memory to create another rwlock\n"); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") rwlock %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, ret); \
break; \
} \
} \
ret; \
})

Definition at line 324 of file threads-debug.h.

#define SCRWLockRDLock (   rwl)    SCRWLockRDLock_dbg(rwl)

Definition at line 365 of file threads-debug.h.

#define SCRWLockRDLock_dbg (   rwl)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locking rwlock %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl); \
int retl = pthread_rwlock_rdlock(rwl); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locked rwlock %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, retl); \
if (retl != 0) { \
switch (retl) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
retl = pthread_rwlock_init(rwl, NULL); \
if (retl != 0) \
exit(EXIT_FAILURE); \
retl = pthread_rwlock_rdlock(rwl); \
break; \
case EDEADLK: \
printf("A deadlock would occur if the thread blocked waiting for rwlock\n"); \
break; \
} \
} \
retl; \
})

When dbg threads is defined, if a rwlock fail to lock, it's initialized, logged, and does a second try; This is to prevent the system to freeze; If you see a rwlock, spinlock or condiion not initialized, report it please!

Definition at line 247 of file threads-debug.h.

#define SCRWLockTryRDLock (   rwl)    SCRWLockTryRDLock_dbg(rwl)

Definition at line 368 of file threads-debug.h.

#define SCRWLockTryRDLock_dbg (   rwl)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocking rwlock %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl); \
int rett = pthread_rwlock_tryrdlock(rwl); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocked rwlock %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, rett); \
if (rett != 0) { \
switch (rett) { \
case EINVAL: \
printf("%16s(%s:%d): The value specified by attr is invalid\n", __FUNCTION__, __FILE__, __LINE__); \
break; \
case EBUSY: \
printf("RWLock is already locked\n"); \
break; \
} \
} \
rett; \
})

Definition at line 307 of file threads-debug.h.

#define SCRWLockTryWRLock (   rwl)    SCRWLockTryWRLock_dbg(rwl)

Definition at line 367 of file threads-debug.h.

#define SCRWLockTryWRLock_dbg (   rwl)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocking rwlock %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl); \
int rett = pthread_rwlock_trywrlock(rwl); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocked rwlock %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, rett); \
if (rett != 0) { \
switch (rett) { \
case EINVAL: \
printf("%16s(%s:%d): The value specified by attr is invalid\n", __FUNCTION__, __FILE__, __LINE__); \
break; \
case EBUSY: \
printf("RWLock is already locked\n"); \
break; \
} \
} \
rett; \
})

Definition at line 290 of file threads-debug.h.

#define SCRWLockUnlock (   rwl)    SCRWLockUnlock_dbg(rwl)

Definition at line 369 of file threads-debug.h.

#define SCRWLockUnlock_dbg (   rwl)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocking rwlock %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl); \
int retu = pthread_rwlock_unlock(rwl); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocked rwlock %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, retu); \
if (retu != 0) { \
switch (retu) { \
case EINVAL: \
printf("%16s(%s:%d): The value specified by attr is invalid\n", __FUNCTION__, __FILE__, __LINE__); \
break; \
case EPERM: \
printf("The current thread does not hold a lock on rwlock\n"); \
break; \
} \
} \
retu; \
})

Definition at line 346 of file threads-debug.h.

#define SCRWLockWRLock (   rwl)    SCRWLockWRLock_dbg(rwl)

Definition at line 366 of file threads-debug.h.

#define SCRWLockWRLock_dbg (   rwl)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locking rwlock %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl); \
int retl = pthread_rwlock_wrlock(rwl); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locked rwlock %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), rwl, retl); \
if (retl != 0) { \
switch (retl) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
retl = pthread_rwlock_init(rwl, NULL); \
if (retl != 0) \
exit(EXIT_FAILURE); \
retl = pthread_rwlock_wrlock(rwl); \
break; \
case EDEADLK: \
printf("A deadlock would occur if the thread blocked waiting for rwlock\n"); \
break; \
} \
} \
retl; \
})

Definition at line 268 of file threads-debug.h.

#define SCSpinDestroy   SCSpinDestroy_dbg

Definition at line 239 of file threads-debug.h.

Referenced by PacketProfileLoggertIdToString(), and TimeDeinit().

#define SCSpinDestroy_dbg (   spin)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") condition %p waiting\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin); \
int ret = pthread_spin_destroy(spin); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") condition %p passed %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin, ret); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
break; \
case EBUSY: \
printf("A thread currently holds the lock\n"); \
break; \
case ENOMEM: \
printf("The process cannot allocate enough memory to create another spin\n"); \
break; \
case EAGAIN: \
printf("The system temporarily lacks the resources to create another spin\n"); \
break; \
} \
ret; \
})

Definition at line 213 of file threads-debug.h.

#define SCSpinInit   SCSpinInit_dbg

Definition at line 238 of file threads-debug.h.

Referenced by PacketProfileLoggertIdToString(), and TimeInit().

#define SCSpinInit_dbg (   spin,
  spin_attr 
)
Value:
({ \
int ret = pthread_spin_init(spin, spin_attr); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") spinlock %p initialization returned %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin, ret); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
break; \
case EBUSY: \
printf("A thread currently holds the lock\n"); \
break; \
case ENOMEM: \
printf("The process cannot allocate enough memory to create another spin\n"); \
break; \
case EAGAIN: \
printf("The system temporarily lacks the resources to create another spin\n"); \
break; \
} \
ret; \
})

Definition at line 193 of file threads-debug.h.

#define SCSpinlock   pthread_spinlock_t

Definition at line 234 of file threads-debug.h.

Referenced by PacketProfileLoggertIdToString().

#define SCSpinLock   SCSpinLock_dbg

Definition at line 235 of file threads-debug.h.

Referenced by PacketProfileLoggertIdToString(), TimeGet(), and TimeSet().

#define SCSpinLock_dbg (   spin)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") locking spin %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin); \
int ret = pthread_spin_lock(spin); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocked spin %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin, ret); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
break; \
case EDEADLK: \
printf("A deadlock would occur if the thread blocked waiting for spin\n"); \
break; \
} \
ret; \
})

Definition at line 145 of file threads-debug.h.

#define SCSpinTrylock   SCSpinTrylock_dbg

Definition at line 236 of file threads-debug.h.

#define SCSpinTrylock_dbg (   spin)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocking spin %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin); \
int ret = pthread_spin_trylock(spin); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") trylocked spin %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin, ret); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
break; \
case EDEADLK: \
printf("A deadlock would occur if the thread blocked waiting for spin\n"); \
break; \
case EBUSY: \
printf("A thread currently holds the lock\n"); \
break; \
} \
ret; \
})

Definition at line 160 of file threads-debug.h.

#define SCSpinUnlock   SCSpinUnlock_dbg

Definition at line 237 of file threads-debug.h.

Referenced by PacketProfileLoggertIdToString(), TimeGet(), and TimeSet().

#define SCSpinUnlock_dbg (   spin)
Value:
({ \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlocking spin %p\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin); \
int ret = pthread_spin_unlock(spin); \
printf("%16s(%s:%d): (thread:%"PRIuMAX") unlockedspin %p ret %" PRId32 "\n", __FUNCTION__, __FILE__, __LINE__, (uintmax_t)pthread_self(), spin, ret); \
switch (ret) { \
case EINVAL: \
printf("The value specified by attr is invalid\n"); \
break; \
case EPERM: \
printf("The calling thread does not hold the lock\n"); \
break; \
} \
ret; \
})

Definition at line 178 of file threads-debug.h.