Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

后端 未结 17 1287
臣服心动
臣服心动 2020-11-22 17:26

What\'s a better way to start a thread, _beginthread, _beginthreadx or CreateThread?

I\'m trying to determine what are the adv

17条回答
  •  抹茶落季
    2020-11-22 17:34

    CreateThread() once was a no-no because the CRT would be incorrectly initialize/clean up. But this is now history: One can now (using VS2010 and probably a few versions back) call CreateThread() without breaking the CRT.

    Here is the official MS confirmation. It states one exception:

    Actually, the only function that should not be used in a thread created with CreateThread() is the signal() function.

    However, from consistence point of view, I personally prefer to keep using _beginthreadex().

提交回复
热议问题