diff mbox

[PATCHv6,32/38] example: timer: using agnostic function for ODP threads

Message ID 1462984942-53326-33-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard May 11, 2016, 4:42 p.m. UTC
timer_test is changed to use the implementation agnostic ODP thread
create and join functions, from helpers.
timer_test is hence no longer aware on how the odpthread is
implemented.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 example/timer/odp_timer_test.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index f1d3be4..87690ab 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -195,7 +195,7 @@  static void test_abs_timeouts(int thr, test_globals_t *gbls)
  *
  * @return Pointer to exit status
  */
-static void *run_thread(void *ptr)
+static int run_thread(void *ptr)
 {
 	int thr;
 	odp_pool_t msg_pool;
@@ -213,7 +213,7 @@  static void *run_thread(void *ptr)
 
 	if (msg_pool == ODP_POOL_INVALID) {
 		EXAMPLE_ERR("  [%i] msg_pool not found\n", thr);
-		return NULL;
+		return -1;
 	}
 
 	odp_barrier_wait(&gbls->test_barrier);
@@ -223,7 +223,7 @@  static void *run_thread(void *ptr)
 
 	printf("Thread %i exits\n", thr);
 	fflush(NULL);
-	return NULL;
+	return 0;
 }
 
 
@@ -322,7 +322,7 @@  static void parse_args(int argc, char *argv[], test_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 num_workers;
 	odp_queue_t queue;
 	uint64_t tick, ns;
@@ -333,7 +333,7 @@  int main(int argc, char *argv[])
 	odp_cpumask_t cpumask;
 	char cpumaskstr[ODP_CPUMASK_STR_SIZE];
 	odp_instance_t instance;
-	odph_linux_thr_params_t thr_params;
+	odph_odpthread_params_t thr_params;
 	odp_shm_t shm = ODP_SHM_INVALID;
 	test_globals_t *gbls = NULL;
 	int err = 0;
@@ -497,10 +497,10 @@  int main(int argc, char *argv[])
 	thr_params.thr_type = ODP_THREAD_WORKER;
 	thr_params.instance = instance;
 
-	odph_linux_pthread_create(thread_tbl, &cpumask, &thr_params);
+	odph_odpthreads_create(thread_tbl, &cpumask, &thr_params);
 
 	/* Wait for worker threads to exit */
-	odph_linux_pthread_join(thread_tbl, num_workers);
+	odph_odpthreads_join(thread_tbl);
 
 	/* free resources */
 	if (odp_queue_destroy(queue))