- /* start the queue thread */
- memset (&queue_thread, 0, sizeof (queue_thread));
- status = pthread_create (&queue_thread,
- NULL, /* attr */
- queue_thread_main,
- NULL); /* args */
+ /* start the queue threads */
+ queue_threads = calloc(config_queue_threads, sizeof(*queue_threads));
+ if (queue_threads == NULL)
+ {
+ RRDD_LOG (LOG_ERR, "FATAL: cannot calloc queue threads");
+ cleanup();
+ return (1);
+ }
+ for (int i = 0; i < config_queue_threads; i++)
+ {
+ memset (&queue_threads[i], 0, sizeof (*queue_threads));
+ status = pthread_create (&queue_threads[i], NULL, queue_thread_main, NULL);
+ if (status != 0)
+ {
+ RRDD_LOG (LOG_ERR, "FATAL: cannot create queue thread");
+ cleanup();
+ return (1);
+ }
+ }
+
+ /* start the flush thread */
+ memset(&flush_thread, 0, sizeof(flush_thread));
+ status = pthread_create (&flush_thread, NULL, flush_thread_main, NULL);