[PATCH 0/2] util/aio-posix: fix and clean up poll_ready handling in aio_prepare()

Bin Guo posted 2 patches 1 month ago
Only 0 patches received!
util/aio-posix.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 7 deletions(-)
[PATCH 0/2] util/aio-posix: fix and clean up poll_ready handling in aio_prepare()
Posted by Bin Guo 1 month ago
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(-)

-- 
2.50.1 (Apple Git-155)