done = true;
}
SCMutexUnlock(&loader->m);
+ if (!done) {
+ /* nudge thread in case it's sleeping */
+ SCCtrlMutexLock(loader->tv->ctrl_mutex);
+ pthread_cond_broadcast(loader->tv->ctrl_cond);
+ SCCtrlMutexUnlock(loader->tv->ctrl_mutex);
+ }
}
SCMutexLock(&loader->m);
if (loader->result != 0) {
while (tv != NULL) {
if (strncmp(tv->name,"DL#",3) == 0) {
BUG_ON(tv->ctrl_cond == NULL);
+ SCCtrlMutexLock(tv->ctrl_mutex);
pthread_cond_broadcast(tv->ctrl_cond);
+ SCCtrlMutexUnlock(tv->ctrl_mutex);
}
tv = tv->next;
}
/* pass thread data back to caller */
*data = ftd;
+ DetectLoaderControl *loader = &loaders[ftd->instance];
+ SCMutexLock(&loader->m);
+ loader->tv = t;
+ SCMutexUnlock(&loader->m);
+
return TM_ECODE_OK;
}
typedef struct DetectLoaderControl_ {
int id;
int result; /* 0 for ok, error otherwise */
+ ThreadVars *tv; /* loader threads threadvars - for waking them up */
SCMutex m;
TAILQ_HEAD(, DetectLoaderTask_) task_list;
} DetectLoaderControl;