Stream.CreateWaitHandle Stream.CreateWaitHandle Stream.CreateWaitHandle Stream.CreateWaitHandle Method

定義

警告

此 API 現已淘汰。

配置 WaitHandle 物件。Allocates a WaitHandle object.

protected:
 virtual System::Threading::WaitHandle ^ CreateWaitHandle();
[System.Obsolete("CreateWaitHandle will be removed eventually.  Please use "new ManualResetEvent(false)" instead.")]
protected virtual System.Threading.WaitHandle CreateWaitHandle ();
abstract member CreateWaitHandle : unit -> System.Threading.WaitHandle
override this.CreateWaitHandle : unit -> System.Threading.WaitHandle
Protected Overridable Function CreateWaitHandle () As WaitHandle

傳回

所配置 WaitHandle 的參考。A reference to the allocated WaitHandle.

備註

目前的方法呼叫時第一次,會建立WaitHandle物件,並傳回它。When called for the first time, the current method creates a WaitHandle object and returns it. 在後續呼叫中,CreateWaitHandle傳回新的等候控制代碼的參考。On subsequent calls, CreateWaitHandle returns a reference to a new wait handle.

使用這個方法,如果您實作非同步方法,並需要封鎖使用這種EndReadEndWrite直到非同步作業完成為止。Use this method if you implement the asynchronous methods and require a way of blocking in EndRead or EndWrite until the asynchronous operation is complete.

適用於

另請參閱