diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2022-06-21 12:05:46 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2022-06-29 15:18:20 +0300 |
commit | 51d95ccadbb0c9ca30e6bdbb5a18f2aed9c3d3d4 (patch) | |
tree | 064d37a129cd25604c5519ea29ef08053ec8714d /test/validation/api/thread | |
parent | 8f370b65fddded40bbb6764c03fef610dafee0e9 (diff) |
validation: common: thread specific argument support
Changed odp_cunit_thread_create() function to support thread
specific argument pointers. Currently, most test cases don't
pass argument pointer, or pass the same pointer for all created
threads. These are supported (arg = NULL, priv = 0), but in
addition thread specific pointers can be given (priv = 1). This
allows specifying different roles for threads of a test case.
odp_cunit_thread_exit() was renamed to odp_cunit_thread_join()
to match the helper function name better.
Also, changed timer test case to use global memory for passing
queue type, as global memory is used for other parameters already
(and thread argument pointed into main thread stack).
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'test/validation/api/thread')
-rw-r--r-- | test/validation/api/thread/thread.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c index 6499140a3..7fe4a8c8f 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread/thread.c @@ -114,12 +114,12 @@ static void thread_test_odp_thrmask_worker(void) { odp_thrmask_t mask; int ret; - pthrd_arg args = { .testcase = 0, .numthrds = 1 }; + int num = 1; CU_ASSERT_FATAL(odp_thread_type() == ODP_THREAD_CONTROL); - odp_barrier_init(&global_mem->bar_entry, args.numthrds + 1); - odp_barrier_init(&global_mem->bar_exit, args.numthrds + 1); + odp_barrier_init(&global_mem->bar_entry, num + 1); + odp_barrier_init(&global_mem->bar_exit, num + 1); /* should start out with 0 worker threads */ ret = odp_thrmask_worker(&mask); @@ -127,10 +127,10 @@ static void thread_test_odp_thrmask_worker(void) CU_ASSERT(ret == 0); /* start the test thread(s) */ - ret = odp_cunit_thread_create(thread_func, &args); - CU_ASSERT(ret == args.numthrds); + ret = odp_cunit_thread_create(num, thread_func, NULL, 0); + CU_ASSERT(ret == num); - if (ret != args.numthrds) + if (ret != num) return; /* wait for thread(s) to start */ @@ -138,13 +138,13 @@ static void thread_test_odp_thrmask_worker(void) ret = odp_thrmask_worker(&mask); CU_ASSERT(ret == odp_thrmask_count(&mask)); - CU_ASSERT(ret == args.numthrds); + CU_ASSERT(ret == num); CU_ASSERT(ret <= odp_thread_count_max()); /* allow thread(s) to exit */ odp_barrier_wait(&global_mem->bar_exit); - odp_cunit_thread_exit(&args); + odp_cunit_thread_join(num); } static void thread_test_odp_thrmask_control(void) |