开发者

Details of AsyncWaitHandle.WaitOne

1)The call AsyncWaitHandle.WaitOne开发者_如何学C may block client or will definitely block the client?.

2)What is the difference between WaitAll,WaitOne,WaitAny?


  1. WaitHandle.WaitOne() is an instance method that will block until the wait handle is signalled (when the operation is completed). If it has already been signalled previously (i.e. operation already completed) it is possible that the call to WaitOne() will not block.
  2. WaitHandle.WaitAll() and WaitHandle.WaitAny() are static methods that allow you to specify a number of wait handles to monitor simultaneously:

    • WaitHandle.WaitAll() will wait until all of the specified handles have been signalled before it returns.
    • WaitHandle.WaitAny() will return as soon as any of the specified handles have been signalled.

    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. The actual type of this property is WaitHandle, which is an abstract base class for types such as Semaphore, Mutex, and Manual/AutoResetEvent.

See also: Blocking Application Execution Using an AsyncWaitHandle (MSDN)


The methods allow you to wait on a windows events. WaitOne is non-static and waits on the event handle for that object. WaitAll and WaitAny are static class-wide methods that wait an a group of event handlers. WaitAll waits for all events to signal and WaitAny for a single event in the group.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜