I think maybe we should also test a pre-queued (different) I/O APC, if that's not already tested. I will bet money that it behaves like the pre-queued user APC case, but...
Probably worth checking that the event isn't signaled here either. (At least, I assume it isn't, if there's no APC queued...)
Sure, I will add the tests.
I might be missing some way you've already accounted for this, but FILE_SYNCHRONOUS_IO_ALERT doesn't actually apply to all functions. Specifically, it doesn't apply to "always blocking" functions like NtFlushBuffersFile(). At least, that's what our current code has, though I'm not quite sure if it's adequately tested.
Yes, I will add the test for NtFlushBuffersFile(), might be that it will trigger some change.
Not fd_cancel_async() here?
Yes, should be that, I already checked that it works.
``` /* don't signal completion if the async failed synchronously * this can happen if the initial status was unknown (i.e. for device files) * note that we check the IOSB status here, not the initial status */ - if (async->pending || !NT_ERROR( status )) + if (async->pending || async->canceled || !NT_ERROR( status )) ```
Wait, what? This looks like a separate thing, and I'm probably missing something, but I don't see where it's justified by the tests. If it's correct can we please split it into its own patch?
Removing '|| async->canceled' from the final code breaks two tests at least in the same pipe.c: ``` pipe.c:1886: Test failed: aletrable: event is not signaled pipe.c:3235: starting FILE_PIPE_INFORMATION tests pipe.c:3241: starting alertable tests pipe.c:484: Test failed: hEvent signaled ```
Initially I had that as a separate patch after but that resulted in the failures in "test_alertable()" after "ntdll: Make wait in wait_async() always non-alertable.", so I squashed those changes.
More generally some of the parts of this patch could be split anyway, e.g. checking for APCs in async_handoff() could be a separate patch. I don't know if it's necessary but it wouldn't hurt.
That would need adding a part of the test later or that hangs (instead of having the test at once and then shuffling todo's to indicate which parts affect what). But if you think it is better I can do that of course.