diff --git a/testing/getprime/getprime_main.c b/testing/getprime/getprime_main.c index f00801859..11061eedb 100644 --- a/testing/getprime/getprime_main.c +++ b/testing/getprime/getprime_main.c @@ -114,6 +114,7 @@ static void get_prime_in_parallel(int n) pthread_t thread[MAX_THREADS]; pthread_attr_t attr; pthread_addr_t result; + int arg[MAX_THREADS]; int status; int i; @@ -141,9 +142,10 @@ static void get_prime_in_parallel(int n) for (i = 0; i < n; i++) { + arg[i] = i; printf("Start thread #%d\n", i); status = pthread_create(&thread[i], &attr, - thread_func, (FAR void *)&i); + thread_func, (FAR void *)&arg[i]); ASSERT(status == OK); }