aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorJere Leppänen <jere.leppanen@nokia.com>2021-08-13 15:08:39 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2021-09-30 11:10:11 +0300
commitb9b9b4d9a06f7e5ec19c6ea733f2ac7ca6c30b7b (patch)
treef482a0a1ec83aa4142476088bed1198eb2d8df81 /helper
parent36fd6663b71343e09659d7ed5b30788e97d5a8e9 (diff)
helper: test: test odph_thread_create() instead of odph_odpthreads_create()
Test the newer odph_thread_create() and odph_thread_join() functions instead of the deprecated odph_odpthreads_create() and odph_odpthreads_join(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r--helper/test/odpthreads.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c
index 1540ad503..e192f0571 100644
--- a/helper/test/odpthreads.c
+++ b/helper/test/odpthreads.c
@@ -62,8 +62,9 @@ static int worker_fn(void *arg ODP_UNUSED)
int main(int argc, char *argv[])
{
odph_helper_options_t helper_options;
- odph_odpthread_params_t thr_params;
- odph_odpthread_t thread_tbl[NUMBER_WORKERS];
+ odph_thread_t thread_tbl[NUMBER_WORKERS];
+ odph_thread_common_param_t thr_common;
+ odph_thread_param_t thr_param;
odp_cpumask_t cpu_mask;
odp_init_t init_param;
int num_workers;
@@ -143,15 +144,19 @@ int main(int argc, char *argv[])
printf("new cpu mask: %s\n", cpumaskstr);
printf("new num worker threads: %i\n\n", num_workers);
- memset(&thr_params, 0, sizeof(thr_params));
- thr_params.start = worker_fn;
- thr_params.arg = NULL;
- thr_params.thr_type = ODP_THREAD_WORKER;
- thr_params.instance = odp_instance;
+ odph_thread_common_param_init(&thr_common);
+ thr_common.instance = odp_instance;
+ thr_common.cpumask = &cpu_mask;
+ thr_common.share_param = 1;
- odph_odpthreads_create(&thread_tbl[0], &cpu_mask, &thr_params);
+ odph_thread_param_init(&thr_param);
+ thr_param.start = worker_fn;
+ thr_param.arg = NULL;
+ thr_param.thr_type = ODP_THREAD_WORKER;
- ret = odph_odpthreads_join(thread_tbl);
+ odph_thread_create(thread_tbl, &thr_common, &thr_param, num_workers);
+
+ ret = odph_thread_join(thread_tbl, num_workers);
if (ret < 0)
exit(EXIT_FAILURE);