windows _beginthread 与 CreateThread
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2100589/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
_beginthread vs CreateThread
提问by Jay
What is the difference between CreateThread and beginthread APIs in Windows? Which one is preferrable for thread creation?
Windows 中的 CreateThread 和 beginthread API 有什么区别?哪一个更适合创建线程?
回答by Hans Passant
_beginthread()
and _beginthreadex()
was required by earlier versions of the Microsoft CRT to initialize thread-local state. The strtok()
function would be an example. That's been fixed, that state now gets dynamically initialized, at least since VS2005. Using CreateThread()
no longer causes problems.
_beginthread()
并且_beginthreadex()
早期版本的 Microsoft CRT 需要它来初始化线程本地状态。该strtok()
函数将是一个示例。这已被修复,该状态现在被动态初始化,至少从 VS2005 开始。使用CreateThread()
不再导致问题。