无聊看了下CreateEvent的msdn解释:
When the state of a manual-reset event object is signaled, it remains signaled until it is explicitly reset to nonsignaled by the ResetEvent function. Any number of waiting threads, or threads that subsequently begin wait operations for the specified event object, can be released while the object's state is signaled.
When the state of an auto-reset event object is signaled, it remains signaled until a single waiting thread is released; the system then automatically resets the state to nonsignaled. If no threads are waiting, the event object's state remains signaled.
我就在想,如果几个线程都在wait这一个人工重置的事件,之后都马上调用ResetEvent function to reset the state of an event object to nonsignaled. 那么等待该事件的哪些线程会变得可调度,应该是不确定的吧?可能在wait之后到ResetEvent之前这个时间段切换到另一个线程了,这时事件是有信号的,但核心编程又说"当人工重置的事件得到通知时,等待该事件的所有线程均变为可调度线程。当一个自动重置的事件得到通知时,等待该事件的线程中只有一个线程变为可调度线程",有点晕,求教.