[英]Details of AsyncWaitHandle.WaitOne
1)The call AsyncWaitHandle.WaitOne may block client or will definitely block the client?. 1)调用AsyncWaitHandle.WaitOne可能会阻止客户端或肯定会阻止客户端?
2)What is the difference between WaitAll,WaitOne,WaitAny? 2)WaitAll,WaitOne,WaitAny之间有什么区别?
WaitHandle.WaitOne()
is an instance method that will block until the wait handle is signalled (when the operation is completed). WaitHandle.WaitOne()
是一个实例方法,它将阻塞,直到等号句柄发出信号(操作完成时)。 If it has already been signalled previously (ie operation already completed) it is possible that the call to WaitOne()
will not block. WaitOne()
可能不会被阻塞。 WaitHandle.WaitAll()
and WaitHandle.WaitAny()
are static methods that allow you to specify a number of wait handles to monitor simultaneously: WaitHandle.WaitAll()
和WaitHandle.WaitAny()
是静态方法,允许您指定要同时监视的多个等待句柄:
WaitHandle.WaitAll()
will wait until all of the specified handles have been signalled before it returns. WaitHandle.WaitAll()
将等到所有指定的句柄在返回之前发出信号。 WaitHandle.WaitAny()
will return as soon as any of the specified handles have been signalled. WaitHandle.WaitAny()
就会返回。 These methods allow you to monitor a number of outstanding asynchronous operations at the same time. 这些方法允许您同时监视许多未完成的异步操作。
Background: AsyncWaitHandle
is the name of a property on the IAsyncResult
interface. 背景:
AsyncWaitHandle
是IAsyncResult
接口上的属性的名称。 The actual type of this property is WaitHandle
, which is an abstract base class for types such as Semaphore
, Mutex
, and Manual/AutoResetEvent
. 此属性的实际类型是
WaitHandle
,它是Semaphore
, Mutex
和Manual/AutoResetEvent
等类型的抽象基类。
See also: Blocking Application Execution Using an AsyncWaitHandle (MSDN) 另请参阅: 使用AsyncWaitHandle (MSDN) 阻止应用程序执行
The methods allow you to wait on a windows events. 这些方法允许您等待Windows事件。 WaitOne is non-static and waits on the event handle for that object.
WaitOne是非静态的,并等待该对象的事件句柄。 WaitAll and WaitAny are static class-wide methods that wait an a group of event handlers.
WaitAll和WaitAny是静态类范围的方法,等待一组事件处理程序。 WaitAll waits for all events to signal and WaitAny for a single event in the group.
WaitAll等待所有事件发出信号,WaitAny等待组中的单个事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.