char tname[TM_THREAD_NAME_MAX];
char qname[TM_QUEUE_NAME_MAX];
char *queues = NULL;
- uint16_t thread = 0;
/* Available cpus */
uint16_t ncpus = UtilCpuGetNumProcessorsOnline();
thread_max = ncpus * threading_detect_ratio;
if (thread_max < 1)
thread_max = 1;
- if (thread_max > 1024)
+ if (thread_max > 1024) {
+ SCLogWarning(SC_ERR_RUNMODE, "limited number of 'worker' threads to 1024. Wanted %d", thread_max);
thread_max = 1024;
+ }
queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
if (queues == NULL) {
aconf = ConfigParser(live_dev);
if (aconf == NULL) {
- SCLogError(SC_ERR_RUNMODE, "Failed to allocate config for %s (%d)",
- live_dev, thread);
+ SCLogError(SC_ERR_RUNMODE, "Failed to allocate config for %s",
+ live_dev);
exit(EXIT_FAILURE);
}
threads_count, recv_mod_name);
/* create the threads */
- for (thread = 0; thread < threads_count; thread++) {
+ for (int thread = 0; thread < MIN(thread_max, threads_count); thread++) {
snprintf(tname, sizeof(tname), "%s#%02d", thread_name, thread+1);
ThreadVars *tv_receive =
TmThreadCreatePacketHandler(tname,
}
} else { /* Multiple input device */
SCLogInfo("Using %d live device(s).", nlive);
- int lthread;
- for (lthread = 0; lthread < nlive; lthread++) {
+ for (int lthread = 0; lthread < nlive; lthread++) {
const char *dev = LiveGetDeviceName(lthread);
const char *visual_devname = LiveGetShortName(dev);
void *aconf;
}
threads_count = ModThreadsCount(aconf);
- for (thread = 0; thread < threads_count; thread++) {
+ for (int thread = 0; thread < threads_count; thread++) {
snprintf(tname, sizeof(tname), "%s#%02d-%s", thread_name,
thread+1, visual_devname);
}
}
- for (thread = 0; thread < (uint16_t)thread_max; thread++) {
+ for (int thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1);
snprintf(qname, sizeof(qname), "pickup%u", thread+1);
const char *live_dev, void *aconf,
unsigned char single_mode)
{
- int thread;
int threads_count;
if (single_mode) {
}
/* create the threads */
- for (thread = 0; thread < threads_count; thread++) {
+ for (int thread = 0; thread < threads_count; thread++) {
char tname[TM_THREAD_NAME_MAX];
ThreadVars *tv = NULL;
TmModule *tm_module = NULL;
TmModule *tm_module ;
const char *cur_queue = NULL;
char *queues = NULL;
- uint16_t thread;
/* Available cpus */
uint16_t ncpus = UtilCpuGetNumProcessorsOnline();
thread_max = ncpus * threading_detect_ratio;
if (thread_max < 1)
thread_max = 1;
- if (thread_max > 1024)
+ if (thread_max > 1024) {
+ SCLogWarning(SC_ERR_RUNMODE, "limited number of 'worker' threads to 1024. Wanted %d", thread_max);
thread_max = 1024;
+ }
queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
if (queues == NULL) {
}
}
- for (thread = 0; thread < (uint16_t)thread_max; thread++) {
+ for (int thread = 0; thread < thread_max; thread++) {
snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread+1);
snprintf(qname, sizeof(qname), "pickup%u", thread+1);