Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

后端 未结 17 1492
臣服心动
臣服心动 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:54

    If you read the book Debugging Windows Application From Jeffrey Richter in it he explains that almost in all instances you must call _beginthreadex instead of calling CreateThread. _beginthread is just a simplified wrapper around _beginthreadex.

    _beginthreadex initializes certain CRT (C RunTime) internals that the CreateThread API would not do.

    A consequence if you use the CreateThread API instead of using _begingthreadex calls to CRT functions might unexpected cause issues.

    Check out this old Microsoft Journal From Richter.

提交回复
热议问题