lhmouse / mcfgthread

Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
https://gcc-mcf.lhmouse.com/
Other
277 stars 28 forks source link

Question about thread.c #57

Closed CarterLi closed 2 years ago

CarterLi commented 2 years ago

It uses CreateThread

However MSDN suggests using _beginthreadex when a thread calls the C run-time library (CRT) which I assume everyone ( that has Win32 programming experience ) knows.

Why did you do that?

lhmouse commented 2 years ago

mcfgthread is linked against no CRT, so those functions don't exist.

https://github.com/lhmouse/mcfgthread/blob/54af5a49c0c52f50eee20ad410c5992da8c07d1d/src/Makefile.inc.am#L37

CarterLi commented 2 years ago

However programs that use your lib call those functions

For example: https://github.com/lhmouse/mcfgthread/blob/master/mutex_performance.c#L96

lhmouse commented 2 years ago

If you link against the CRT as a DLL (such MSVCRT or UCRT) then there is no problem or leak whatsoever. It only makes a difference if you link against a static CRT.

CarterLi commented 2 years ago

If you link against the CRT as a DLL (such MSVCRT or UCRT) then there is no problem or leak whatsoever. It only makes a difference if you link against a static CRT.

citation needed

lhmouse commented 2 years ago

Why don't you read UCRT source yourself? If you have Windows SDK install you should have had it.