threading: shrink and reorganize TmSlot

pull/4531/head
Victor Julien 7 years ago
parent 87c9b11d8c
commit 261b77742e

@ -785,12 +785,15 @@ void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data)
return;
memset(slot, 0, sizeof(TmSlot));
SC_ATOMIC_INIT(slot->slot_data);
slot->tv = tv;
slot->SlotThreadInit = tm->ThreadInit;
slot->slot_initdata = data;
slot->SlotFunc = tm->Func;
slot->PktAcqLoop = tm->PktAcqLoop;
slot->Management = tm->Management;
if (tm->Func) {
slot->SlotFunc = tm->Func;
} else if (tm->PktAcqLoop) {
slot->PktAcqLoop = tm->PktAcqLoop;
} else if (tm->Management) {
slot->Management = tm->Management;
}
slot->SlotThreadExitPrintStats = tm->ThreadExitPrintStats;
slot->SlotThreadDeinit = tm->ThreadDeinit;
/* we don't have to check for the return value "-1". We wouldn't have

@ -50,13 +50,15 @@ static inline void SleepUsec(uint64_t usec)
typedef TmEcode (*TmSlotFunc)(ThreadVars *, Packet *, void *, PacketQueue *);
typedef struct TmSlot_ {
/* the TV holding this slot */
ThreadVars *tv;
/* function pointers */
TmSlotFunc SlotFunc;
TmEcode (*PktAcqLoop)(ThreadVars *, void *, void *);
union {
TmSlotFunc SlotFunc;
TmEcode (*PktAcqLoop)(ThreadVars *, void *, void *);
TmEcode (*Management)(ThreadVars *, void *);
};
/** linked list of slots, used when a pipeline has multiple slots
* in a single thread. */
struct TmSlot_ *slot_next;
TmEcode (*SlotThreadInit)(ThreadVars *, const void *, void **);
void (*SlotThreadExitPrintStats)(ThreadVars *, void *);
@ -77,12 +79,6 @@ typedef struct TmSlot_ {
/* slot id, only used my TmVarSlot to know what the first slot is */
int id;
/* linked list, only used when you have multiple slots(used by TmVarSlot) */
struct TmSlot_ *slot_next;
/* just called once, so not perf critical */
TmEcode (*Management)(ThreadVars *, void *);
} TmSlot;
extern ThreadVars *tv_root[TVT_MAX];

Loading…
Cancel
Save