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
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 *);
/* 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];