From c8ce57d668d73d92a071fa86f81e07ca403d8672 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 9 Dec 2024 13:33:11 -0800 Subject: 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. --- src/core/device.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/device.c') diff --git a/src/core/device.c b/src/core/device.c index 815fafcc..7084d3e4 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -228,9 +228,8 @@ nni_device(nni_aio *aio, nni_sock *s1, nni_sock *s2) nni_aio_finish_error(aio, rv); return; } - if ((rv = nni_aio_schedule(aio, device_cancel, d)) != 0) { + if (!nni_aio_defer(aio, device_cancel, d)) { nni_mtx_unlock(&device_mtx); - nni_aio_finish_error(aio, rv); nni_reap(&device_reap, d); } device_start(d, aio); -- cgit v1.2.3-70-g09d2