[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 16:55:56 CDT 2022


Inspired by the discussion for MR 127 (https://www.winehq.org/pipermail/wine-devel/2022-May/217832.html) and is aimed to replace the second patch (ws2_32: Use allocated IO status block in select().) in that MR.

When the thread calls server's terminate_thread for itself queuing the system APC though SIGUSR1 might race with the thread exit, there seems no easy and reliable way to be sure that signal is processed before the thread's stack and TEB are freed. Thus I am making the system APCs to be queued to the thread to be processed by server_select() after (terminate_thread) server call.

When terminate_thread is called for the other thread the system APC will always be delivered through some other thread. Thread stack and TEB are not freed when the thread is killed externally, so completing the async from another thread should probably be fine.

--
  v4: ws2_32/tests: Add tests for terminated thread asyncs completion.
      ntdll: Cancel asyncs when thread is terminated.
 
https://gitlab.winehq.org/wine/wine/-/merge_requests/135



More information about the wine-devel mailing list