读书人

线程同步简单有关问题~小白

发布时间: 2013-07-04 11:45:55 作者: rapoo

线程同步简单问题~小白求助~
我的问题是关于这个函数
WaitForSingleObject(
HANDLE hHandle,
DWORD dwMilliseconds
);
WaitForSingleObject 函数用来检测 hHandle 事件的信号状态,当函数的执行时间超过 dwMilliseconds 就返回,但如果参数 dwMilliseconds 为 INFINITE 时函数将直到相应时间事件变成有信号状态才返回。
这是我在网上搜索到的用法,我想请教一下,什么叫做事件变成有信号状态?
谢谢大家~ 多线程
[解决办法]
根据 Handle 的类型不同, "有信号状态"有不同的含义

[解决办法]
《Windows核心编程》

About Synchronization
To synchronize access to a resource, use one of the synchronization objects in one of the wait functions. The state of a synchronization object is either signaled or nonsignaled. The wait functions allow a thread to block its own execution until a specified nonsignaled object is set to the signaled state.

The following are other synchronization mechanisms:

overlapped input and output
asynchronous procedure calls
critical section objects
interlocked variable access

读书人网 >C++

热点推荐