diff mbox

[v2] validation: shmem: sync threads with barrier

Message ID 1453486391-20353-1-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit 14b492984ff76b2a21f1bddc69af39ad33680c01
Headers show

Commit Message

Ivan Khoronzhuk Jan. 22, 2016, 6:13 p.m. UTC
It's not convenient to see reused a thread id for threads that are
finished to fast.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/validation/shmem/shmem.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bill Fischofer Jan. 25, 2016, 12:42 a.m. UTC | #1
On Fri, Jan 22, 2016 at 12:13 PM, Ivan Khoronzhuk <
ivan.khoronzhuk@linaro.org> wrote:

> It's not convenient to see reused a thread id for threads that are

> finished to fast.

>

> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  test/validation/shmem/shmem.c | 4 ++++

>  1 file changed, 4 insertions(+)

>

> diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c

> index 5524b5c..08425e6 100644

> --- a/test/validation/shmem/shmem.c

> +++ b/test/validation/shmem/shmem.c

> @@ -13,6 +13,8 @@

>  #define TEST_SHARE_FOO (0xf0f0f0f0)

>  #define TEST_SHARE_BAR (0xf0f0f0f)

>

> +static odp_barrier_t test_barrier;

> +

>  static void *run_shm_thread(void *arg)

>  {

>         odp_shm_info_t  info;

> @@ -20,6 +22,7 @@ static void *run_shm_thread(void *arg)

>         test_shared_data_t *test_shared_data;

>         int thr;

>

> +       odp_barrier_wait(&test_barrier);

>         thr = odp_thread_id();

>         printf("Thread %i starts\n", thr);

>

> @@ -72,6 +75,7 @@ void shmem_test_odp_shm_sunnyday(void)

>         if (thrdarg.numthrds > MAX_WORKERS)

>                 thrdarg.numthrds = MAX_WORKERS;

>

> +       odp_barrier_init(&test_barrier, thrdarg.numthrds);

>         odp_cunit_thread_create(run_shm_thread, &thrdarg);

>         odp_cunit_thread_exit(&thrdarg);

>  }

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov Jan. 25, 2016, 11:20 a.m. UTC | #2
Merged,
Maxim.

On 01/25/2016 03:42, Bill Fischofer wrote:
>
>
> On Fri, Jan 22, 2016 at 12:13 PM, Ivan Khoronzhuk 
> <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:
>
>     It's not convenient to see reused a thread id for threads that are
>     finished to fast.
>
>     Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
>     <mailto:ivan.khoronzhuk@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      test/validation/shmem/shmem.c | 4 ++++
>      1 file changed, 4 insertions(+)
>
>     diff --git a/test/validation/shmem/shmem.c
>     b/test/validation/shmem/shmem.c
>     index 5524b5c..08425e6 100644
>     --- a/test/validation/shmem/shmem.c
>     +++ b/test/validation/shmem/shmem.c
>     @@ -13,6 +13,8 @@
>      #define TEST_SHARE_FOO (0xf0f0f0f0)
>      #define TEST_SHARE_BAR (0xf0f0f0f)
>
>     +static odp_barrier_t test_barrier;
>     +
>      static void *run_shm_thread(void *arg)
>      {
>             odp_shm_info_t  info;
>     @@ -20,6 +22,7 @@ static void *run_shm_thread(void *arg)
>             test_shared_data_t *test_shared_data;
>             int thr;
>
>     +       odp_barrier_wait(&test_barrier);
>             thr = odp_thread_id();
>             printf("Thread %i starts\n", thr);
>
>     @@ -72,6 +75,7 @@ void shmem_test_odp_shm_sunnyday(void)
>             if (thrdarg.numthrds > MAX_WORKERS)
>                     thrdarg.numthrds = MAX_WORKERS;
>
>     +       odp_barrier_init(&test_barrier, thrdarg.numthrds);
>     odp_cunit_thread_create(run_shm_thread, &thrdarg);
>             odp_cunit_thread_exit(&thrdarg);
>      }
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c
index 5524b5c..08425e6 100644
--- a/test/validation/shmem/shmem.c
+++ b/test/validation/shmem/shmem.c
@@ -13,6 +13,8 @@ 
 #define TEST_SHARE_FOO (0xf0f0f0f0)
 #define TEST_SHARE_BAR (0xf0f0f0f)
 
+static odp_barrier_t test_barrier;
+
 static void *run_shm_thread(void *arg)
 {
 	odp_shm_info_t  info;
@@ -20,6 +22,7 @@  static void *run_shm_thread(void *arg)
 	test_shared_data_t *test_shared_data;
 	int thr;
 
+	odp_barrier_wait(&test_barrier);
 	thr = odp_thread_id();
 	printf("Thread %i starts\n", thr);
 
@@ -72,6 +75,7 @@  void shmem_test_odp_shm_sunnyday(void)
 	if (thrdarg.numthrds > MAX_WORKERS)
 		thrdarg.numthrds = MAX_WORKERS;
 
+	odp_barrier_init(&test_barrier, thrdarg.numthrds);
 	odp_cunit_thread_create(run_shm_thread, &thrdarg);
 	odp_cunit_thread_exit(&thrdarg);
 }