aboutsummaryrefslogtreecommitdiff
path: root/src/core/aio_test.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-06-02 09:52:48 -0700
committerGarrett D'Amore <garrett@damore.org>2021-06-02 09:52:48 -0700
commit310ff3250d0ae824aef08d08a9d62a974121a102 (patch)
treebd23b4dd6aa14e8ce7138416834f3af590219b4e /src/core/aio_test.c
parent512fe447b0c5494e0f4dd7d07202c5ce4f269de3 (diff)
downloadnng-310ff3250d0ae824aef08d08a9d62a974121a102.tar.gz
nng-310ff3250d0ae824aef08d08a9d62a974121a102.tar.bz2
nng-310ff3250d0ae824aef08d08a9d62a974121a102.zip
Extend times for aio_sleep cancel test for benefit of Darwin
Diffstat (limited to 'src/core/aio_test.c')
-rw-r--r--src/core/aio_test.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/aio_test.c b/src/core/aio_test.c
index ea1ec8c0..afce43e2 100644
--- a/src/core/aio_test.c
+++ b/src/core/aio_test.c
@@ -259,7 +259,6 @@ aio_sleep_loop(void *arg)
sleep_loop *sl = arg;
nng_mtx_lock(sl->mx);
if (nng_aio_result(sl->aio) != 0) {
- printf("HERE!\n");
sl->result = nng_aio_result(sl->aio);
sl->done = true;
nng_cv_wake(sl->cv);
@@ -301,7 +300,7 @@ test_sleep_loop(void)
nng_cv_until(sl.cv, 2000);
}
nng_mtx_unlock(sl.mx);
- dur = nng_clock() - start;
+ dur = (nng_duration) (nng_clock() - start);
NUTS_ASSERT(dur >= 150);
NUTS_ASSERT(dur <= 500); // allow for sloppy clocks
NUTS_ASSERT(sl.done);
@@ -322,7 +321,7 @@ test_sleep_cancel(void)
sl.limit = 10;
sl.count = 0;
- sl.interval = 50; // ms
+ sl.interval = 100; // ms
sl.done = false;
NUTS_PASS(nng_aio_alloc(&sl.aio, aio_sleep_loop, &sl));
@@ -330,15 +329,15 @@ test_sleep_cancel(void)
NUTS_PASS(nng_cv_alloc(&sl.cv, sl.mx));
start = nng_clock();
- nng_sleep_aio(50, sl.aio);
- nng_msleep(75);
+ nng_sleep_aio(100, sl.aio);
+ nng_msleep(125);
nng_aio_cancel(sl.aio);
nng_mtx_lock(sl.mx);
while (!sl.done) {
nng_cv_until(sl.cv, 2000);
}
nng_mtx_unlock(sl.mx);
- dur = nng_clock() - start;
+ dur = (nng_duration) (nng_clock() - start);
NUTS_ASSERT(dur >= 50);
NUTS_ASSERT(dur <= 200); // allow for sloppy clocks
NUTS_ASSERT(sl.done);