On Mon Jan 27 17:37:54 2025 +0000, Paul Gofman wrote:
In fact, APC is always processed in alertable sleep if APC is available, it is not random. Not sure, maybe in early patches versions when another thread was involved there was some race. So there is no alternative here, if apc is queued and wait is alertable, APC should be processed and reflected in the status. Also, test currently has leftover queued APC. How about incorporating the attached diff (the diff is on top but would be applied to the first patch): it solves those (in particular, pops leftover APC with SleepEx(0, TRUE)) and makes this a bit more straightforward. [test.patch](/uploads/a38e87b1795d7259321cf46b50808e1d/test.patch)
Yes, that was an issue in earlier versions. Your diff makes sense, but we don't have any test cases where `!alertable && queue_apc`, so the `else...if (tests[i].queue_apc)` branch will never run. It should do the work of popping leftover APCs if I just move those outside the `else`.