From 63cb1818edc86796348e68dfe808e5837ab0a028 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 26 Apr 2010 17:59:00 +0200 Subject: [PATCH] Move TmThread*Flag functions to the header so they can be inline with gnu99 as well. --- src/tm-threads.c | 44 -------------------------------------------- src/tm-threads.h | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/tm-threads.c b/src/tm-threads.c index 348ea76225..713d4b0e1f 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -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) { diff --git a/src/tm-threads.h b/src/tm-threads.h index ff3d956c5b..fd5799de47 100644 --- a/src/tm-threads.h +++ b/src/tm-threads.h @@ -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__ */