diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-09 13:33:11 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-22 21:31:28 -0800 |
| commit | c8ce57d668d73d92a071fa86f81e07ca403d8672 (patch) | |
| tree | ad7e602e43fefa64067fdac5fcd23987a50c3a90 /src/core/tcp.c | |
| parent | 013bb69c6be2f0a4572f4200de05e664692b6704 (diff) | |
| download | nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.tar.gz nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.tar.bz2 nng-c8ce57d668d73d92a071fa86f81e07ca403d8672.zip | |
aio: introduce nni_aio_defer
This will replace nni_aio_schedule, and it includes finishing the
task if needed. It does so without dropping the lock and so is
more efficient and race free.
This includes some conversion of some subsystems to it.
Diffstat (limited to 'src/core/tcp.c')
| -rw-r--r-- | src/core/tcp.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/tcp.c b/src/core/tcp.c index d2e08493..75b938b0 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -177,7 +177,6 @@ static void tcp_dialer_dial(void *arg, nng_aio *aio) { tcp_dialer *d = arg; - int rv; if (nni_aio_begin(aio) != 0) { return; } @@ -187,9 +186,8 @@ tcp_dialer_dial(void *arg, nng_aio *aio) nni_aio_finish_error(aio, NNG_ECLOSED); return; } - if ((rv = nni_aio_schedule(aio, tcp_dial_cancel, d)) != 0) { + if (!nni_aio_defer(aio, tcp_dial_cancel, d)) { nni_mtx_unlock(&d->mtx); - nni_aio_finish_error(aio, rv); return; } nni_list_append(&d->conaios, aio); |
