Move TmThread*Flag functions to the header so they can be inline with gnu99 as well.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent bd8111f868
commit 63cb1818ed

@ -76,50 +76,6 @@ typedef struct TmVarSlot_ {
TmSlot *s;
} TmVarSlot;
/**
* \brief Check if a thread flag is set
*
* \retval 1 flag is set
* \retval 0 flag is not set
*/
inline int TmThreadsCheckFlag(ThreadVars *tv, uint8_t flag) {
int r;
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return 0;
}
r = (tv->flags & flag);
SCSpinUnlock(&tv->flags_spinlock);
return r;
}
/**
* \brief Set a thread flag
*/
inline void TmThreadsSetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
tv->flags |= flag;
SCSpinUnlock(&tv->flags_spinlock);
}
/**
* \brief Unset a thread flag
*/
inline void TmThreadsUnsetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
tv->flags &= ~flag;
SCSpinUnlock(&tv->flags_spinlock);
}
/* 1 slot functions */
void *TmThreadsSlot1NoIn(void *td) {

@ -42,9 +42,51 @@ void TmThreadPause(ThreadVars *);
void TmThreadPauseThreads(void);
void TmThreadCheckThreadState(void);
TmEcode TmThreadWaitOnThreadInit(void);
inline int TmThreadsCheckFlag(ThreadVars *, uint8_t);
inline void TmThreadsSetFlag(ThreadVars *, uint8_t);
ThreadVars *TmThreadsGetCallingThread(void);
/**
* \brief Check if a thread flag is set
*
* \retval 1 flag is set
* \retval 0 flag is not set
*/
static inline int TmThreadsCheckFlag(ThreadVars *tv, uint8_t flag) { \
int r;
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return 0;
}
r = (tv->flags & flag);
SCSpinUnlock(&tv->flags_spinlock);
return r;
}
/**
* \brief Set a thread flag
*/
static inline void TmThreadsSetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
tv->flags |= flag;
SCSpinUnlock(&tv->flags_spinlock);
}
/**
* \brief Unset a thread flag
*/
static inline void TmThreadsUnsetFlag(ThreadVars *tv, uint8_t flag) {
if (SCSpinLock(&tv->flags_spinlock) != 0) {
SCLogError(SC_ERR_SPINLOCK,"spin lock errno=%d",errno);
return;
}
tv->flags &= ~flag;
SCSpinUnlock(&tv->flags_spinlock);
}
#endif /* __TM_THREADS_H__ */

Loading…
Cancel
Save