llvmpipe: Don't wait for already-terminated threads on Windows
authorJesse Natalie <jenatali@microsoft.com>
Sat, 4 Sep 2021 19:18:21 +0000 (12:18 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Sep 2021 16:19:10 +0000 (16:19 +0000)
commit67065f99c52abaa3dea18d0c4771375fc649c197
tree226f7b6bd8f4169602d0fe59fbbfd3c51a569512
parentcd46cad0a7b4f8b4113d74eaeb60a51c1b966710
llvmpipe: Don't wait for already-terminated threads on Windows

In the case of an app returning from main(), Windows will apparently terminate
other threads before invoking final cleanup on the main thread.

llvmpipe can't wait for threads to signal a semaphore if the thread is already
gone. Since we're already in a WIN32 special case, just call the Win32 API
to check if the thread is terminated or STILL_ALIVE.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12731>
src/gallium/drivers/llvmpipe/lp_rast.c