diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-07-01 12:43:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-01 12:43:17 -0700 |
| commit | f9fa485df941c9336c49fa5be4f9346754218128 (patch) | |
| tree | f00ae3d04a81a0497d43b5f7d67535904b32912c /src | |
| parent | 2a841afb2601e8bc8e2127cb196d64fd5d6fa8a9 (diff) | |
| download | nng-f9fa485df941c9336c49fa5be4f9346754218128.tar.gz nng-f9fa485df941c9336c49fa5be4f9346754218128.tar.bz2 nng-f9fa485df941c9336c49fa5be4f9346754218128.zip | |
fixes #1456 bad access in OSX thread on nn (#1457)
* fixes #1456 bad access in OSX thread on nn
* Fix broken aio in darwin cloud.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/aio_test.c | 8 | ||||
| -rw-r--r-- | src/core/socket.c | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/core/aio_test.c b/src/core/aio_test.c index afce43e2..18f9baeb 100644 --- a/src/core/aio_test.c +++ b/src/core/aio_test.c @@ -294,7 +294,7 @@ test_sleep_loop(void) NUTS_PASS(nng_cv_alloc(&sl.cv, sl.mx)); start = nng_clock(); - nng_sleep_aio(50, sl.aio); + nng_sleep_aio(100, sl.aio); nng_mtx_lock(sl.mx); while (!sl.done) { nng_cv_until(sl.cv, 2000); @@ -330,7 +330,7 @@ test_sleep_cancel(void) start = nng_clock(); nng_sleep_aio(100, sl.aio); - nng_msleep(125); + nng_msleep(150); nng_aio_cancel(sl.aio); nng_mtx_lock(sl.mx); while (!sl.done) { @@ -338,8 +338,8 @@ test_sleep_cancel(void) } nng_mtx_unlock(sl.mx); dur = (nng_duration) (nng_clock() - start); - NUTS_ASSERT(dur >= 50); - NUTS_ASSERT(dur <= 200); // allow for sloppy clocks + NUTS_ASSERT(dur >= 100); + NUTS_ASSERT(dur <= 500); // allow for sloppy clocks NUTS_ASSERT(sl.done); NUTS_FAIL(sl.result, NNG_ECANCELED); NUTS_ASSERT(sl.count == 1); diff --git a/src/core/socket.c b/src/core/socket.c index 82267287..90a99c20 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -519,13 +519,11 @@ sock_destroy(nni_sock *s) s->s_sock_ops.sock_fini(s->s_data); } + nni_mtx_lock(&s->s_mx); while ((sopt = nni_list_first(&s->s_options)) != NULL) { nni_list_remove(&s->s_options, sopt); nni_free_opt(sopt); } - - // This exists to silence a false positive in helgrind. - nni_mtx_lock(&s->s_mx); nni_mtx_unlock(&s->s_mx); nni_msgq_fini(s->s_urq); |
