mirror of https://github.com/ericonr/erm.git
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:
parent
5b4396c4a1
commit
aa22e06b23
10
remove.c
10
remove.c
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue