testing: getprime: Fix the thread number info

Summary:
- I noticed that getprime sometimes shows a wrong thread number
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with sabre-6quad:netnsh

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2022-08-25 17:05:40 +09:00 committed by Xiang Xiao
parent 4d86c69a22
commit 1bf462e1c1

View File

@ -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);
}