危险的pluseEvent

危险的pluseEvent
      PulseEvent是将指定的事件设为有信号状态,如果是一个人工重设事件,正在等候事件的、被挂起的所有线程都会进入活动状态,函数随后将事件设回,并返回;如果是一个自动重设事件,则正在等候事件的、被挂起的单个线程会进入活动状态,事件随后设回无信号,并且函数返回。
      但是等待线程必须在PulseEvent的一个脉冲时正在等待才能被激活。
        While the thread is sitting waiting for the event, a device driver or part of the kernel itself might ask to borrow the thread to do some processing (by means of a "kernel-mode APC"). During that time, the thread is not in the wait state. (It's being used by the device driver.) If the PulseEvent happens while the thread is being "borrowed", then it will not be woken from the wait, because the PulseEvent function wakes only threads that were waiting at the time the PulseEvent occurs.
      一个线程处于等待状态的过程中,会有一些瞬间其状态并不为“等待状态”。这就造成PulseEvent()不能激活应该被激活的等待线程。
     这些瞬间包括什么呢?比如发生了系统调用,缺页中断,硬件中断......等等。

你可能感兴趣的:(危险的pluseEvent)