return NULL;
}
+/**
+ * Also returns if the kill flag is set.
+ */
void TmThreadsWaitForUnpause(ThreadVars *tv)
{
if (TmThreadsCheckFlag(tv, THV_PAUSE)) {
TmThreadsSetFlag(tv, THV_PAUSED);
- TmThreadTestThreadUnPaused(tv);
+
+ while (TmThreadsCheckFlag(tv, THV_PAUSE)) {
+ SleepUsec(100);
+
+ if (TmThreadsCheckFlag(tv, THV_KILL))
+ break;
+ }
+
TmThreadsUnsetFlag(tv, THV_PAUSED);
}
}
}
}
-/**
- * \brief Tests if the thread represented in the arg has been unpaused or not.
- *
- * The function would return if the thread tv has been unpaused or if the
- * kill flag for the thread has been set.
- *
- * \param tv Pointer to the TV instance.
- */
-void TmThreadTestThreadUnPaused(ThreadVars *tv)
-{
- while (TmThreadsCheckFlag(tv, THV_PAUSE)) {
- SleepUsec(100);
-
- if (TmThreadsCheckFlag(tv, THV_KILL))
- break;
- }
-}
-
/**
* \brief Waits till the specified flag(s) is(are) set. We don't bother if
* the kill flag has been set or not on the thread.
int TmThreadGetNbThreads(uint8_t type);
void TmThreadInitMC(ThreadVars *);
-void TmThreadTestThreadUnPaused(ThreadVars *);
void TmThreadContinue(ThreadVars *);
void TmThreadContinueThreads(void);
void TmThreadCheckThreadState(void);
uint16_t TmThreadsGetWorkerThreadMax(void);
bool TmThreadsTimeSubsysIsReady(void);
-/** \brief Wait for a thread to become unpaused. */
+/** \brief Wait for a thread to become unpaused.
+ *
+ * Check if a thread should wait to be unpaused and wait if so, or
+ * until the thread kill flag is set.
+ */
void TmThreadsWaitForUnpause(ThreadVars *tv);
#endif /* SURICATA_TM_THREADS_H */