Bug in thread implementation under windows?

Hi.

I think I’ve spotted a bug in the implementation of thread creation under
windows. Currently it uses the CreateThread call, but it should use
_beginthreadex, in order to do some C lib startup, according to the msdn
docs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createthread.asp

Regards,
Bruno

Bruno Mart?nez wrote:

I think I’ve spotted a bug in the implementation of thread
under windows. Currently it uses the CreateThread call,
but it should use _beginthreadex, in order to do some C lib
startup, according to the msdn docs

Indeed, since the SDL.dll links to (and uses) MSVCRT.DLL, it should call
_beginthread (not necessarily _beginthreadex) from the MS crt to create
threads. The penalty for not doing so, however, is a small memory leak per
ended thread.

-Alex.

I think I’ve spotted a bug in the implementation of thread
under windows. Currently it uses the CreateThread call,
but it should use _beginthreadex, in order to do some C lib
startup, according to the msdn docs

Indeed, since the SDL.dll links to (and uses) MSVCRT.DLL, it should call
_beginthread (not necessarily _beginthreadex) from the MS crt to create
threads. The penalty for not doing so, however, is a small memory leak per
ended thread.

(catching up on my email queue and TODO list here, sorry for late
replies…)

What should Cygwin use in this case?

–ryan.

Indeed, since the SDL.dll links to (and uses) MSVCRT.DLL, it should call
_beginthread (not necessarily _beginthreadex) from the MS crt to create
threads. The penalty for not doing so, however, is a small memory leak per
ended thread.

What should Cygwin use in this case?

The same thing. SDL built under cygwin by default uses mingw, which is pure
MSVC runtime, and should use the same semantics.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

The same thing. SDL built under cygwin by default uses mingw, which is pure
MSVC runtime, and should use the same semantics.

Ok, good…I’ll put this on the TODO list to fix.

Thanks,
–ryan.