简体   繁体   English

AsyncWaitHandle.WaitOne的详细信息

[英]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之间有什么区别?

  1. 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()可能不会被阻塞。
  2. 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. 背景: AsyncWaitHandleIAsyncResult接口上的属性的名称。 The actual type of this property is WaitHandle , which is an abstract base class for types such as Semaphore , Mutex , and Manual/AutoResetEvent . 此属性的实际类型是WaitHandle ,它是SemaphoreMutexManual/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.

相关问题 在非UI线程上调用AsyncWaitHandle.WaitOne时出现NotSupportedException - NotSupportedException when calling AsyncWaitHandle.WaitOne on non-UI Thread 使用 AsyncWaitHandle.WaitOne 在 C# 中执行一行之前添加延迟 - using AsyncWaitHandle.WaitOne to add delay before executing a line in C# AsyncWaitHandle.WaitOne阻止CLR线程吗? 或者它是否创建了I / O完成端口? - Does AsyncWaitHandle.WaitOne block the CLR thread? Or does it create an I/O completion port? 如果侦听服务已关闭,为什么TcpClient.BeginConnect结果的AsyncWaitHandle.WaitOne不返回false? - Why doesn't TcpClient.BeginConnect result's AsyncWaitHandle.WaitOne return false if the listening service is down? IAsyncResult.AsyncWaitHandle.WaitOne()在回调之前完成 - IAsyncResult.AsyncWaitHandle.WaitOne() completes ahead of callback IAsyncResult.IsCompleted,iftAR.AsyncWaitHandle.WaitOne和AsyncCallback的使用条件 - Usage criteria for IAsyncResult.IsCompleted, iftAR.AsyncWaitHandle.WaitOne and AsyncCallback 为什么 IAsyncResult.AsyncWaitHandle.WaitOne 在 wifi 没有 inte.net 连接且移动数据已打开时返回 false? (XAMARIN) - Why does IAsyncResult.AsyncWaitHandle.WaitOne return false when wifi has no internet connection and mobile data is turned on? (XAMARIN) WaitHandle AsyncWaitHandle - WaitHandle AsyncWaitHandle IAsyncResult.AsyncWaitHandle的使用 - Use of IAsyncResult.AsyncWaitHandle 在BeginXXX和EndXXX方法中使用AsyncWaitHandle - Use of AsyncWaitHandle in BeginXXX and EndXXX methods
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM