aboutsummaryrefslogtreecommitdiff
path: root/test/validation/shmem/shmem.c
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-01-22 20:13:11 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-01-25 14:17:06 +0300
commit14b492984ff76b2a21f1bddc69af39ad33680c01 (patch)
tree9875d823c1514ed58094c9d56b3f06ebb9735ab8 /test/validation/shmem/shmem.c
parent25ad2c7aa5cf98395e4a966ccbfa184045b43a44 (diff)
validation: shmem: sync threads with barrier
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> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test/validation/shmem/shmem.c')
-rw-r--r--test/validation/shmem/shmem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/validation/shmem/shmem.c b/test/validation/shmem/shmem.c
index 5524b5cc1..08425e663 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);
}