[PATCH v4 0/2] MR135: Cancel asyncs queued by thread when the thread is terminated

Paul Gofman (@gofman) wine at gitlab.winehq.org
Mon Jun 6 17:04:46 CDT 2022

v4 changes:
1. Get server_select() in NtTerminateThread() back for terminating self;
2. Make (terminate_thread) server call unconditional in NtTerminateThread() (that was missed earlier, that call should always be there for properly canceling asyncs);
3. After p. 2. it appeared that things are more convoluted that we initially thought as the tests in ws2_32/tests/sock.c:test_iocp() started failing. There are tests which show that, e. g., an async from overlapped WSARecv() doesn't get canceled when thread which queued it exits. It required some investigation and much more testing, and so also after some discussion of intermediate results with Zebediah I figured out that the asyncs are not actual canceled after the following conditions:
  - The async has an associated completion port;
  - The async is queued with nonzero 'apc_context' (that is, the async completion is actually going to be delivered to the completion port);
  - There is no event associated with async.
  So I added much more tests, added corresponding condition to the server part of the patch, and moved test after the implementation to avoid obscure temporary bypassing of test failures which becomes a bit convoluted.


More information about the wine-devel mailing list