From: Fabian Maurer dark.shadow4@web.de
Since we stop the thread in DllMain, we always haev the loaderlock. Thread shutdown also requires the loader lock, so we will always time out So just wait until all cleanup is done, the thread itself can exit later
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52314 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/dinput/dinput_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index d3db22c70b5..d68c5032ed0 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1320,6 +1320,7 @@ static DWORD WINAPI dinput_thread_proc( void *params ) done: DestroyWindow( di_em_win ); di_em_win = NULL; + SetEvent(finished_event); return 0; }
@@ -1347,9 +1348,13 @@ static void dinput_thread_start(void)
static void dinput_thread_stop(void) { - PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 0, 0 ); - if (WaitForSingleObject( dinput_thread, 500 ) == WAIT_TIMEOUT) - WARN("Timeout while waiting for internal thread\n"); + HANDLE finished_event = CreateEventW( NULL, FALSE, FALSE, NULL ); + + PostThreadMessageW( dinput_thread_id, WM_USER + 0x10, 0, (LPARAM)finished_event ); + + WaitForSingleObject( finished_event, INFINITE ); + + CloseHandle( finished_event ); CloseHandle( dinput_thread ); }