? Differences between CreateThread and _beginthread
! There are four methods to terminate sub thread
- return from the end of the function
- ExitThread itself
- TerminateThread by other thread
- Terminate the owed process
? windows code should be using ExitThread; c/c++ code should be used _endthread to terminate the thread. So definition of windows code and c++/c code?
! ExitThread以及函数返回能够释放分配给线程的堆栈空间,然后使用TerminateThread将不会通知被关闭线程(同时他也是异步的),如果使用了这个方法,就只能等待拥有这个线程的进程关闭来释放。这个原理是windows估值设计,同时也适用于DLL创建的线程。
原文链接: https://www.cnblogs.com/rogerroddick/archive/2013/04/27/3048072.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/86218
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!