Don't allocate thread list.

Since we aren't using pthread_join to finish the program or tracking
threads individually, we can simply create the thread and detach it.
This commit is contained in:
Érico Nogueira 2022-01-21 15:47:20 -03:00
parent 5b4396c4a1
commit aa22e06b23
1 changed files with 5 additions and 5 deletions

View File

@ -241,11 +241,11 @@ void run_queue(void)
pthread_attr_setguardsize(&pattr, 1)) exit_init();
#endif
pthread_t *threads = calloc(sizeof(pthread_t), nproc1);
if (!threads) exit_init();
for (unsigned i = 0; i < nproc1; i++)
if (pthread_create(threads+i, &pattr, process_queue_item, &queue)) exit_init();
for (unsigned i = 0; i < nproc1; i++) {
pthread_t thread;
if (pthread_create(&thread, &pattr, process_queue_item, &queue)) exit_init();
pthread_detach(thread);
}
pthread_attr_destroy(&pattr);
}