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:
parent
4d86c69a22
commit
1bf462e1c1
@ -114,6 +114,7 @@ static void get_prime_in_parallel(int n)
|
|||||||
pthread_t thread[MAX_THREADS];
|
pthread_t thread[MAX_THREADS];
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
pthread_addr_t result;
|
pthread_addr_t result;
|
||||||
|
int arg[MAX_THREADS];
|
||||||
int status;
|
int status;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -141,9 +142,10 @@ static void get_prime_in_parallel(int n)
|
|||||||
|
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
|
arg[i] = i;
|
||||||
printf("Start thread #%d\n", i);
|
printf("Start thread #%d\n", i);
|
||||||
status = pthread_create(&thread[i], &attr,
|
status = pthread_create(&thread[i], &attr,
|
||||||
thread_func, (FAR void *)&i);
|
thread_func, (FAR void *)&arg[i]);
|
||||||
ASSERT(status == OK);
|
ASSERT(status == OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user