win_wrap::threading

Function wait_for_single_object

Source
pub fn wait_for_single_object(h_handle: HANDLE, milliseconds: u32) -> WAIT_EVENT
Expand description

等待指定的对象处于信号状态或超时间隔已过。若要进入可警报等待状态,请使用 wait_for_single_object_ex 函数。若要等待多个对象,请使用 wait_for_multiple_objects。 h_handle 对象的句柄。如果在等待仍处于挂起状态时关闭此句柄,则函数的行为未定义。句柄必须具有 SYNCHRONIZE 访问权限。 milliseconds 超时间隔(以毫秒为单位)。如果指定了非零值,则函数将等待,直到发出对象信号或间隔已过。如果 milliseconds 为零,则如果未向对象发出信号,则函数不会进入等待状态;它始终立即返回。如果 milliseconds 为 INFINITE,则函数仅在发出对象信号时返回。Windows XP、Windows Server 2003、Windows Vista、Windows 7、Windows Server 2008 和 Windows Server 2008 R2:milliseconds 值包括在低功率状态下花费的时间。例如,当计算机处于睡眠状态时,超时也会持续倒计时。Windows 8、Windows Server 2012、Windows 8.1、Windows Server 2012 R2、Windows 10和Windows Server 2016:milliseconds 值不包括在低功率状态下花费的时间。例如,当计算机处于睡眠状态时,超时会暂停倒计时。