diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-12-10 22:17:23 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-12-12 11:32:51 -0800 |
| commit | 2033988343bce413763d3e9664e3e8372da48591 (patch) | |
| tree | f39ce75c40dd94f95884d7d4c43a76df510a86bf /src/core/aio_test.c | |
| parent | b45f876d005371f62fc261a5584c4d7dafd7a0f7 (diff) | |
| download | nng-2033988343bce413763d3e9664e3e8372da48591.tar.gz nng-2033988343bce413763d3e9664e3e8372da48591.tar.bz2 nng-2033988343bce413763d3e9664e3e8372da48591.zip | |
fixes #1313 support deferred nng_aio destruction
Diffstat (limited to 'src/core/aio_test.c')
| -rw-r--r-- | src/core/aio_test.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/core/aio_test.c b/src/core/aio_test.c index 3dab4b04..acf3c129 100644 --- a/src/core/aio_test.c +++ b/src/core/aio_test.c @@ -35,7 +35,7 @@ void test_sleep(void) { nng_time start; - nng_time end = 0; + nng_time end = 0; nng_aio *aio; NUTS_PASS(nng_aio_alloc(&aio, sleep_done, &end)); @@ -55,7 +55,7 @@ void test_sleep_timeout(void) { nng_time start; - nng_time end = 0; + nng_time end = 0; nng_aio *aio; NUTS_TRUE(nng_aio_alloc(&aio, sleep_done, &end) == 0); @@ -226,6 +226,22 @@ test_zero_timeout(void) NUTS_PASS(nng_close(s)); } +static void +aio_sleep_cb(void *arg) +{ + nng_aio *aio = *(nng_aio **) arg; + nng_aio_reap(aio); +} + +void +test_aio_reap(void) +{ + nng_aio *a; + NUTS_PASS(nng_aio_alloc(&a, aio_sleep_cb, &a)); + nng_sleep_aio(10, a); + nng_msleep(20); +} + NUTS_TESTS = { { "sleep", test_sleep }, { "sleep timeout", test_sleep_timeout }, @@ -236,5 +252,6 @@ NUTS_TESTS = { { "explicit timeout", test_explicit_timeout }, { "inherited timeout", test_inherited_timeout }, { "zero timeout", test_zero_timeout }, + { "aio reap", test_aio_reap }, { NULL, NULL }, };
\ No newline at end of file |
