On Tue Jul 22 20:46:26 2025 +0000, Paul Gofman wrote:
Also, maybe there is simplier way to achieve the same? Ref https://gitlab.winehq.org/wine/wine/-/merge_requests/8592 . It is not exactly related as touches different cases, in particular, NtCancelSynchronousIoFile() handling WRT the synchronous IO wait but not NtCancelIoFile with asynchronous IO. But is there anything which would prevent in principle creating and relaying to NtCancelIoFile the same wait_handle to the async being canceled and then just performing wait_async() on it same way as with synchronous IO? Presumably the cancellation then may go without much changes and complications on the server side or elsewhere. It will still need a way to wait for multiple asyncs, but then maybe cancel_async() may return the handles for all at once.
Note that async's wait_handle signaling logic should probably account for everything already WRT synchronous IO wait (in particular, terminating wait on cancelled but not before the cancellation is processed and IOSB is filled). So why not to use exact same mechanics here if we need to wait for async to conclude after cancellation request in NtCancelIoFile?