[PATCH 6/7] msvcrt: Make UCRT _beginthread[ex]() hold the DLL reference.
Piotr Caban
piotr.caban at gmail.com
Tue May 4 07:39:17 CDT 2021
Hi Arek,
On 5/4/21 1:49 PM, Arkadiusz Hiler wrote:
> /*********************************************************************
> @@ -88,7 +90,17 @@ void CDECL _endthreadex(
> {
> TRACE("(%d)\n", retval);
>
> - /* FIXME */
> +#if _MSVCR_VER >= 140
> + {
> + thread_data_t *tls = TlsGetValue(msvcrt_tls_index);
> +
> + if (tls && tls->module != NULL)
> + FreeLibraryAndExitThread(tls->module, retval);
> + else
> + WARN("tls=%p tls->module=%p\n", tls, tls ? tls->module : NULL);
> + }
> +#endif
> +
> ExitThread(retval);
> }
I didn't test it but I bet that _endthreadex should still close the
handle if thread was created by _beginthread. It will also make the
_endthread and _endthreadex functions identical. Did you check it?
Thanks,
Piotr
More information about the wine-devel
mailing list