diff mbox

[2/2] timer : replace pthread_create with pthread_create_single

Message ID 1406722571-23556-2-git-send-email-santosh.shukla@linaro.org
State New
Headers show

Commit Message

Santosh Shukla July 30, 2014, 12:16 p.m. UTC
replacing pthread_create with pthread_create_single
would fix incorrect thread_tbl[] entry problem, Previously
pthread_join used to have wrong thread_tbl[] index entry
to exit which lead to segfault in some platform, noticed
on x-gen  and on my x86 server machine too.

This patch should fix that problem.

Signed-off-by: santosh shukla <santosh.shukla@linaro.org>
---
 test/api_test/odp_timer_ping.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Santosh Shukla July 30, 2014, 12:18 p.m. UTC | #1
Ankit,

Can you Pl. verify with this patch sets whether it helps to remove
timer segfault in your case?

TIA!

On 30 July 2014 17:46, Santosh Shukla <santosh.shukla@linaro.org> wrote:
> replacing pthread_create with pthread_create_single
> would fix incorrect thread_tbl[] entry problem, Previously
> pthread_join used to have wrong thread_tbl[] index entry
> to exit which lead to segfault in some platform, noticed
> on x-gen  and on my x86 server machine too.
>
> This patch should fix that problem.
>
> Signed-off-by: santosh shukla <santosh.shukla@linaro.org>
> ---
>  test/api_test/odp_timer_ping.c |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index cd67e0d..ba5b4f8 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -362,13 +362,16 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>                 void *(*run_thread) (void *);
>
>                 if (i == 0)
> -                       run_thread = rx_ping;
> -               else
>                         run_thread = send_ping;
> +               else
> +                       run_thread = rx_ping;
>
> -               /* Create and launch worker threads */
> -               odp_linux_pthread_create(thread_tbl, 1, i,
> -                                        run_thread, (pthrd_arg *)&pingarg);
> +               /* Create and launch worker threads
> +                * and pin to (i) core number
> +                * */
> +               odp_linux_pthread_create_single(thread_tbl, i, i,
> +                                               run_thread,
> +                                               (pthrd_arg *)&pingarg);
>         }
>
>         /* Wait for worker threads to exit */
> --
> 1.7.9.5
>
diff mbox

Patch

diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index cd67e0d..ba5b4f8 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -362,13 +362,16 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 		void *(*run_thread) (void *);
 
 		if (i == 0)
-			run_thread = rx_ping;
-		else
 			run_thread = send_ping;
+		else
+			run_thread = rx_ping;
 
-		/* Create and launch worker threads */
-		odp_linux_pthread_create(thread_tbl, 1, i,
-					 run_thread, (pthrd_arg *)&pingarg);
+		/* Create and launch worker threads
+		 * and pin to (i) core number
+		 * */
+		odp_linux_pthread_create_single(thread_tbl, i, i,
+						run_thread,
+						(pthrd_arg *)&pingarg);
 	}
 
 	/* Wait for worker threads to exit */