threads/flow: assist branch prediction

pull/12675/head
Victor Julien 1 year ago committed by Victor Julien
parent f876baab6b
commit 99eda1504a

@ -2345,23 +2345,23 @@ uint16_t TmThreadsGetWorkerThreadMax(void)
*/
void TmThreadsInjectFlowById(Flow *f, const int id)
{
BUG_ON(id <= 0 || id > (int)thread_store.threads_size);
int idx = id - 1;
Thread *t = &thread_store.threads[idx];
ThreadVars *tv = t->tv;
BUG_ON(tv == NULL || tv->flow_queue == NULL);
FlowEnqueue(tv->flow_queue, f);
/* wake up listening thread(s) if necessary */
if (tv->inq != NULL) {
SCMutexLock(&tv->inq->pq->mutex_q);
SCCondSignal(&tv->inq->pq->cond_q);
SCMutexUnlock(&tv->inq->pq->mutex_q);
} else if (tv->break_loop) {
TmThreadsCaptureBreakLoop(tv);
if (id > 0 && id <= (int)thread_store.threads_size) {
int idx = id - 1;
Thread *t = &thread_store.threads[idx];
ThreadVars *tv = t->tv;
if (tv != NULL && tv->flow_queue != NULL) {
FlowEnqueue(tv->flow_queue, f);
/* wake up listening thread(s) if necessary */
if (tv->inq != NULL) {
SCMutexLock(&tv->inq->pq->mutex_q);
SCCondSignal(&tv->inq->pq->cond_q);
SCMutexUnlock(&tv->inq->pq->mutex_q);
} else if (tv->break_loop) {
TmThreadsCaptureBreakLoop(tv);
}
return;
}
}
BUG_ON(1);
}

Loading…
Cancel
Save