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

◆ SCCondDestroy

#define SCCondDestroy   pthread_cond_destroy

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

◆ SCCondInit

#define SCCondInit   pthread_cond_init

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

◆ SCCondSignal

#define SCCondSignal   pthread_cond_signal

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

◆ SCCondT

#define SCCondT   pthread_cond_t

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

◆ SCCondWait

#define SCCondWait   SCCondWait_dbg

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

◆ 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; \
})

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

◆ SCCtrlCondDestroy

#define SCCtrlCondDestroy   pthread_cond_destroy

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

◆ SCCtrlCondInit

#define SCCtrlCondInit   pthread_cond_init

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

◆ SCCtrlCondSignal

#define SCCtrlCondSignal   pthread_cond_signal

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

◆ SCCtrlCondT

#define SCCtrlCondT   pthread_cond_t

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

◆ SCCtrlCondTimedwait

#define SCCtrlCondTimedwait   pthread_cond_timedwait

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

◆ SCCtrlCondWait

#define SCCtrlCondWait   pthread_cond_wait

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

◆ SCCtrlMutex

#define SCCtrlMutex   pthread_mutex_t

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

◆ SCCtrlMutexAttr

#define SCCtrlMutexAttr   pthread_mutexattr_t

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

◆ SCCtrlMutexDestroy

#define SCCtrlMutexDestroy   pthread_mutex_destroy

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

◆ SCCtrlMutexInit

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

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

◆ SCCtrlMutexLock

#define SCCtrlMutexLock (   mut)    pthread_mutex_lock(mut)

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

◆ SCCtrlMutexTrylock

#define SCCtrlMutexTrylock (   mut)    pthread_mutex_trylock(mut)

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

◆ SCCtrlMutexUnlock

#define SCCtrlMutexUnlock (   mut)    pthread_mutex_unlock(mut)

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

◆ SCMutex

#define SCMutex   pthread_mutex_t

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

◆ SCMUTEX_INITIALIZER

#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER

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

◆ SCMutexAttr

#define SCMutexAttr   pthread_mutexattr_t

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

◆ SCMutexDestroy

#define SCMutexDestroy   pthread_mutex_destroy

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

◆ SCMutexInit

#define SCMutexInit (   mut,
  mutattrs 
)    SCMutexInit_dbg(mut, mutattrs)

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

◆ SCMutexInit_dbg

#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 76 of file threads-debug.h.

◆ SCMutexLock

#define SCMutexLock (   mut)    SCMutexLock_dbg(mut)

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

◆ SCMutexLock_dbg

#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 condition not initialized, report it please!

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

◆ SCMutexTrylock

#define SCMutexTrylock (   mut)    SCMutexTrylock_dbg(mut)

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

◆ SCMutexTrylock_dbg

#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 59 of file threads-debug.h.

◆ SCMutexUnlock

#define SCMutexUnlock (   mut)    SCMutexUnlock_dbg(mut)

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

◆ SCMutexUnlock_dbg

#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 98 of file threads-debug.h.

◆ SCRWLock

#define SCRWLock   pthread_rwlock_t

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

◆ SCRWLockDestroy

#define SCRWLockDestroy   pthread_rwlock_destroy

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

◆ SCRWLockInit

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

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

◆ SCRWLockInit_dbg

#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 325 of file threads-debug.h.

◆ SCRWLockRDLock

#define SCRWLockRDLock (   rwl)    SCRWLockRDLock_dbg(rwl)

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

◆ SCRWLockRDLock_dbg

#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 condition not initialized, report it please!

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

◆ SCRWLockTryRDLock

#define SCRWLockTryRDLock (   rwl)    SCRWLockTryRDLock_dbg(rwl)

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

◆ SCRWLockTryRDLock_dbg

#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 308 of file threads-debug.h.

◆ SCRWLockTryWRLock

#define SCRWLockTryWRLock (   rwl)    SCRWLockTryWRLock_dbg(rwl)

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

◆ SCRWLockTryWRLock_dbg

#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 291 of file threads-debug.h.

◆ SCRWLockUnlock

#define SCRWLockUnlock (   rwl)    SCRWLockUnlock_dbg(rwl)

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

◆ SCRWLockUnlock_dbg

#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 347 of file threads-debug.h.

◆ SCRWLockWRLock

#define SCRWLockWRLock (   rwl)    SCRWLockWRLock_dbg(rwl)

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

◆ SCRWLockWRLock_dbg

#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 269 of file threads-debug.h.

◆ SCSpinDestroy

#define SCSpinDestroy   SCSpinDestroy_dbg

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

◆ SCSpinDestroy_dbg

#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 214 of file threads-debug.h.

◆ SCSpinInit

#define SCSpinInit   SCSpinInit_dbg

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

◆ SCSpinInit_dbg

#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 194 of file threads-debug.h.

◆ SCSpinlock

#define SCSpinlock   pthread_spinlock_t

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

◆ SCSpinLock

#define SCSpinLock   SCSpinLock_dbg

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

◆ SCSpinLock_dbg

#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 146 of file threads-debug.h.

◆ SCSpinTrylock

#define SCSpinTrylock   SCSpinTrylock_dbg

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

◆ SCSpinTrylock_dbg

#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 161 of file threads-debug.h.

◆ SCSpinUnlock

#define SCSpinUnlock   SCSpinUnlock_dbg

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

◆ SCSpinUnlock_dbg

#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 179 of file threads-debug.h.

cond
SCCondT cond
Definition: tmqh-packetpool.h:2