From e6751a5c955122db99fd375714bdda232a73c4a9 Mon Sep 17 00:00:00 2001 From: Christophe Milard Date: Fri, 15 Apr 2016 11:47:11 +0200 Subject: example: switch: using agnostic function for ODP threads odp_switch is changed to use the implementation agnostic ODP thread create and join functions, from helpers. odp_switch is hence no longer aware on how the odpthread is implemented. Signed-off-by: Christophe Milard Reviewed-by: Brian Brooks Signed-off-by: Maxim Uvarov --- example/switch/odp_switch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'example/switch/odp_switch.c') diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index 96229ff91..9358c2c29 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -574,7 +574,7 @@ static void bind_workers(void) * * @param arg Thread arguments of type 'thread_args_t *' */ -static void *run_worker(void *arg) +static int run_worker(void *arg) { thread_args_t *thr_args = arg; odp_packet_t pkt_tbl[MAX_PKT_BURST]; @@ -652,7 +652,7 @@ static void *run_worker(void *arg) /* Make sure that latest stat writes are visible to other threads */ odp_mb_full(); - return NULL; + return 0; } /* @@ -878,7 +878,7 @@ static void gbl_args_init(args_t *args) int main(int argc, char **argv) { - odph_linux_pthread_t thread_tbl[MAX_WORKERS]; + odph_odpthread_t thread_tbl[MAX_WORKERS]; int i, j; int cpu; int num_workers; @@ -890,7 +890,7 @@ int main(int argc, char **argv) stats_t (*stats)[MAX_PKTIOS]; int if_count; odp_instance_t instance; - odph_linux_thr_params_t thr_params; + odph_odpthread_params_t thr_params; /* Init ODP before calling anything else */ if (odp_init_global(&instance, NULL, NULL)) { @@ -1003,8 +1003,7 @@ int main(int argc, char **argv) odp_cpumask_zero(&thd_mask); odp_cpumask_set(&thd_mask, cpu); - odph_linux_pthread_create(&thread_tbl[i], &thd_mask, - &thr_params); + odph_odpthreads_create(&thread_tbl[i], &thd_mask, &thr_params); cpu = odp_cpumask_next(&cpumask, cpu); } @@ -1026,7 +1025,8 @@ int main(int argc, char **argv) exit_threads = 1; /* Master thread waits for other threads to exit */ - odph_linux_pthread_join(thread_tbl, num_workers); + for (i = 0; i < num_workers; ++i) + odph_odpthreads_join(&thread_tbl[i]); free(gbl_args->appl.if_names); free(gbl_args->appl.if_str); -- cgit v1.2.3