- pthread_t thread[nr_cpus];
- for (i = 0; i < nr_cpus; i++) {
- if (pthread_create(&thread[i], NULL, function, NULL)) {
+ pthread_t thread[nr_threads];
+ struct thread_counter thread_counter[nr_threads];
+
+ for (i = 0; i < nr_threads; i++) {
+ thread_counter[i].nr_loops = 0;
+ if (pthread_create(&thread[i], NULL, function, &thread_counter[i])) {