为什么CreateThread()调用创建线程时,系统设置线程内核对象的引用计数为1,在Create函数返回前是2
2012-12-05 20:17
351 查看
CreateThread()调用创建线程时,系统设置线程内核对象的引用计数为1,
在Create函数返回前,将会打开线程句柄,所以线程的内核对象引用计数+1。
creating a new process causes the system to create a process kernel object
and a thread kernel object. At creation time, the system gives each object
an initial usage count of 1. Then, just before CreateProcess returns, the
function opens the process object and the thread object and places the
process-relative handles for each in the hProcess and hThread members of
the PROCESS_INFORMATION structure. When CreateProcess opens these objects
internally, the usage count for each becomes 2.
在Create函数返回前,将会打开线程句柄,所以线程的内核对象引用计数+1。
creating a new process causes the system to create a process kernel object
and a thread kernel object. At creation time, the system gives each object
an initial usage count of 1. Then, just before CreateProcess returns, the
function opens the process object and the thread object and places the
process-relative handles for each in the hProcess and hThread members of
the PROCESS_INFORMATION structure. When CreateProcess opens these objects
internally, the usage count for each becomes 2.
相关文章推荐
- 线程、进程内核对象引用计数问题
- 为什么说设备的引用计数为0时,系统会自动调用它的release函数
- 线程、进程内核对象引用计数问题
- 为什么系统报错说:第一个power[i],未将对象引用设置到对象的实例?
- 创建子类对象时,父类构造函数中调用被子类重写的方法为什么调用的是子类的方法,而被子类重载的方法不会调用?
- 我们在创建对象的时候,为什么要调用构造方法并且要给构造方法传入实参???
- Dynamics CRM 安装CRM程序系统检查界面报未将对象引用设置到对象的实例的解决方法
- mongo数据库在用MongoVUE创建表时提示“未将对象引用设置到对象的实例”的解决方案
- Linux0.00内核为什么要自己设置0x80号陷阱门来调用write_char过程?
- 线程核心对象的引用计数
- 了解临时对象的来源 (深刻理解为什么不能返回一个临时变量的引用)
- Dynamics CRM 安装CRM程序系统检查界面报未将对象引用设置到对象的实例的解决方法
- bookone这个书籍对象被我release掉了,此时引用计数为0,为毛还能调用
- mongo数据库在用MongoVUE创建表时提示“未将对象引用设置到对象的实例”的解决方案
- opener 属性是一个可读可写的属性,可返回对创建该窗口的 Window 对象的引用
- Linux0.00内核为什么要自己设置0x80号陷阱门来调用write_char过程?
- Java调用webservice出现System.NullReferenceException: 未将对象引用设置到对象的实例。
- Qt多线程之一:子线程中创建的对象不应再其他线程中被调用,包括使用槽函数的形式
- 为什么可以不创建对象就调用类的成员函数?
- TerminateThread 与 该线程创建的内核对象 无关