[PATCH 6/7] msvcrt: Make UCRT _beginthread[ex]() hold the DLL reference.
Arkadiusz Hiler
ahiler at codeweavers.com
Tue May 4 10:26:51 CDT 2021
On Tue, May 04, 2021 at 02:39:17PM +0200, Piotr Caban wrote:
> 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?
I belive this is covered by msvcrt/tests/misc.c:test_thread_handle_close():
https://source.winehq.org/git/wine.git/blob/3ba4412be60dafee310b5d3c71aa762aa8846564:/dlls/msvcrt/tests/misc.c#l546
--
Cheers,
Arek
More information about the wine-devel
mailing list