diff options
Diffstat (limited to 'test/core/support/sync_test.cc')
-rw-r--r-- | test/core/support/sync_test.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/core/support/sync_test.cc b/test/core/support/sync_test.cc index 3f534de820..fb7ec44754 100644 --- a/test/core/support/sync_test.cc +++ b/test/core/support/sync_test.cc @@ -73,7 +73,7 @@ void queue_append(queue* q, int x) { corresponding condition variable. The predicate must be on state protected by the lock. */ while (q->length == N) { - gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future(GPR_CLOCK_MONOTONIC)); } if (q->length == 0) { /* Wake threads blocked in queue_remove(). */ /* It's normal to use gpr_cv_broadcast() or gpr_signal() while @@ -197,7 +197,7 @@ static void test_create_threads(struct test* m, void (*body)(void* arg)) { static void test_wait(struct test* m) { gpr_mu_lock(&m->mu); while (m->done != 0) { - gpr_cv_wait(&m->done_cv, &m->mu, gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_cv_wait(&m->done_cv, &m->mu, gpr_inf_future(GPR_CLOCK_MONOTONIC)); } gpr_mu_unlock(&m->mu); } @@ -297,7 +297,7 @@ static void inc_by_turns(void* v /*=m*/) { for (i = 0; i != m->iterations; i++) { gpr_mu_lock(&m->mu); while ((m->counter % m->threads) != id) { - gpr_cv_wait(&m->cv, &m->mu, gpr_inf_future(GPR_CLOCK_REALTIME)); + gpr_cv_wait(&m->cv, &m->mu, gpr_inf_future(GPR_CLOCK_MONOTONIC)); } m->counter++; gpr_cv_broadcast(&m->cv); @@ -314,7 +314,7 @@ static void inc_with_1ms_delay(void* v /*=m*/) { for (i = 0; i != m->iterations; i++) { gpr_timespec deadline; gpr_mu_lock(&m->mu); - deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_micros(1000, GPR_TIMESPAN)); while (!gpr_cv_wait(&m->cv, &m->mu, deadline)) { } @@ -370,14 +370,14 @@ static void consumer(void* v /*=m*/) { int64_t i; int value; for (i = 0; i != n; i++) { - queue_remove(&m->q, &value, gpr_inf_future(GPR_CLOCK_REALTIME)); + queue_remove(&m->q, &value, gpr_inf_future(GPR_CLOCK_MONOTONIC)); } gpr_mu_lock(&m->mu); m->counter = n; gpr_mu_unlock(&m->mu); GPR_ASSERT( !queue_remove(&m->q, &value, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_micros(1000000, GPR_TIMESPAN)))); mark_thread_done(m); } |