aboutsummaryrefslogtreecommitdiff
path: root/example/switch
diff options
context:
space:
mode:
authorChristophe Milard <christophe.milard@linaro.org>2016-04-15 11:47:11 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-05-23 15:07:00 +0300
commite6751a5c955122db99fd375714bdda232a73c4a9 (patch)
tree477a2dead25427c2e5713217fc0651eb397bb625 /example/switch
parent3e6d2cf0b1ac2ef5cfddb779abe7e8b04a286355 (diff)
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 <christophe.milard@linaro.org> Reviewed-by: Brian Brooks <brian.brooks@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example/switch')
-rw-r--r--example/switch/odp_switch.c14
1 files changed, 7 insertions, 7 deletions
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);