aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-01-22 20:07:03 +0200
committerIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-02-12 18:55:22 +0200
commitaaad6de5baa2c2da322a22de783635aa798b06c0 (patch)
tree0cf70cda670fab3f16f4a2d9553b19434117b69f
parentd3185c5f001f80d2ae2d1d39ce14549bf022597e (diff)
downloadodp-keystone2-aaad6de5baa2c2da322a22de783635aa798b06c0.tar.gz
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>
-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 5524b5cc..08425e66 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);
}