From patchwork Tue May 17 13:04:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 67974 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2082014qge; Tue, 17 May 2016 06:39:37 -0700 (PDT) X-Received: by 10.140.20.43 with SMTP id 40mr1453856qgi.15.1463492377902; Tue, 17 May 2016 06:39:37 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id i78si2222417qkh.237.2016.05.17.06.39.37; Tue, 17 May 2016 06:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 891D86173D; Tue, 17 May 2016 13:39:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9E925617B1; Tue, 17 May 2016 13:16:40 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 07F3C6184E; Tue, 17 May 2016 13:16:30 +0000 (UTC) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by lists.linaro.org (Postfix) with ESMTPS id 2C525617AF for ; Tue, 17 May 2016 13:05:36 +0000 (UTC) Received: by mail-lb0-f175.google.com with SMTP id ww9so5670346lbc.2 for ; Tue, 17 May 2016 06:05:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Fq1LjNHp5Tgq5H+/sSi6uR8UdLED/l3iJpaRJVPyxRA=; b=iBc3bSIvevA4w5cmDTfDQYWEHHNyX7wkuPZ2rVOMZfL45tCLC+o9h3z5aSghEP0jZ3 EN74yTUhXTsCJBHvE4vedxC5jNgBmSu7XJt5nMmTQmQ9FEOIzegxzYghG0mt4fqyhOsG kxk73WX/4E8WwJa2JZRB3zsA9IVh+Apmwg7NgYXGejmL7+iXjTr5q9UHNUIixtJkTEuc AGXEHIfpcYgACXcxBowl/8xzBlR+dKxdbfKwsJw3xgxvAVD/mNLXqvFuENAhURM5mBlh WziJmhOuk/XSP2P1plE2FDtvDfGugyb0WHAUXLSFn2182X/XvrsYnu6/JlxgEp/OrZYL lNfg== X-Gm-Message-State: AOPr4FVmIyY6G+IKwMMvf0QXGcD/2FCA5WkImovO1wPPLBDKyKv5cmomF8mKGPtkUAJvz10RUSE= X-Received: by 10.112.157.65 with SMTP id wk1mr481352lbb.131.1463490335072; Tue, 17 May 2016 06:05:35 -0700 (PDT) Received: from localhost.localdomain (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id q1sm506536lbo.4.2016.05.17.06.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 May 2016 06:05:34 -0700 (PDT) From: Christophe Milard To: lng-odp@lists.linaro.org, brian.brooks@linaro.org, mike.holmes@linaro.org Date: Tue, 17 May 2016 15:04:36 +0200 Message-Id: <1463490282-23277-30-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> References: <1463490282-23277-1-git-send-email-christophe.milard@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCHv7 29/35] example: timer: using agnostic function for ODP threads X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" 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 --- example/timer/odp_timer_test.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 3880664..2a33085 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -197,7 +197,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; @@ -215,7 +215,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); @@ -225,7 +225,7 @@ static void *run_thread(void *ptr) printf("Thread %i exits\n", thr); fflush(NULL); - return NULL; + return 0; } @@ -324,7 +324,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; @@ -335,7 +335,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; @@ -499,10 +499,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))