Skip to contentSkip to conversation

util/aio-posix: fix and clean up poll_ready handling in aio_prepare()

PATCH New Bin Guo 1 participant 1 message Apr 28

lore
Share & tools
lore

Bin Guo

author
#0 lore raw

cover util/aio-posix: fix and clean up poll_ready handling in aio_prepare()

When aio_prepare() calls poll_set_started(..., false) to disable poll mode before handing control to GLib's event loop, the final poll round may mark handlers poll_ready=true and insert them into a local ready_list. That list is discarded when aio_prepare() returns, so those handlers are silently lost until the next GLib iteration.

Patch 1 fixes the bug: aio_pending() is extended to scan poll_aio_handlers for poll_ready nodes so GLib's check phase reports pending work, and aio_dispatch() is taught to collect those nodes before dispatching, ensuring they are executed in the same cycle.

Patch 2 is a follow-up clean-up: now that poll_ready nodes are handled via aio_pending()/aio_dispatch(), the local ready_list in aio_prepare() serves no purpose. Pass NULL to poll_set_started() and teach it to set poll_ready=true directly, eliminating the unnecessary list operations.

Bin Guo (2):
util/aio-posix: fix poll_ready handlers dropped in aio_prepare() util/aio-posix: avoid allocating ready_list in aio_prepare()

 util/aio-posix.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 40 insertions(+), 7 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)