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/sockfd.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/sockfd.c')
| -rw-r--r-- | src/core/sockfd.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/core/sockfd.c b/src/core/sockfd.c index 787a0783..1a0e792f 100644 --- a/src/core/sockfd.c +++ b/src/core/sockfd.c @@ -115,7 +115,6 @@ static void sfd_listener_accept(void *arg, nng_aio *aio) { sfd_listener *l = arg; - int rv; if (nni_aio_begin(aio) != 0) { return; @@ -129,9 +128,7 @@ sfd_listener_accept(void *arg, nng_aio *aio) if (l->listen_cnt) { sfd_start_conn(l, aio); - } else if ((rv = nni_aio_schedule(aio, sfd_cancel_accept, l)) != 0) { - nni_aio_finish_error(aio, rv); - } else { + } else if (nni_aio_defer(aio, sfd_cancel_accept, l)) { nni_aio_list_append(&l->accept_q, aio); } nni_mtx_unlock(&l->mtx); |
