在 2025-10-3 15:15, Martin Storsjö 写道:
Separately, in practice, winpthreads actually uses _endthreadex, not ExitThread.

First when investigating this issue, I wondered if ExitThread would work better than _endthreadex, but there was no difference. The docs for _endthreadex say "_endthreadex terminates a thread that's created by _beginthreadex.", but main() really isn't such a thread - even though it probably has had the CRT initialized to the same extent as _beginthreadex does.

So all in all, I don't mind disabling the test - it's a kinda iffy thing to do 
in any case.


When linking against a DLL CRT, there's no difference between `_endthreadex()` and `ExitThread()`. But instead of saying that exiting a thread by calling `ExitThread()` is fine within a DLL CRT, the doc [1] says that the other way around, exiting a thread by calling `ExitThread()` is not fine within a static CRT. Well, it's not a technical interpretation, but you get the idea.

My point is mostly that there's a known third-party app - WindHawk - that creates a thread (in almost every process) before `main()` which then never terminates. Other software, such as anti-virus software may also do similar.


[1] 
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/endthread-endthreadex?view=msvc-170



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to