EventWaitHandle EventWaitHandle EventWaitHandle EventWaitHandle Class

定義

スレッドの同期イベントを表します。Represents a thread synchronization event.

public ref class EventWaitHandle : System::Threading::WaitHandle
[System.Runtime.InteropServices.ComVisible(true)]
public class EventWaitHandle : System.Threading.WaitHandle
type EventWaitHandle = class
    inherit WaitHandle
Public Class EventWaitHandle
Inherits WaitHandle
継承
属性

次のコード例では、SignalAndWait(WaitHandle, WaitHandle)ブロックされたスレッドのシグナルを待ってから、スレッドがタスクを完了するまでメイン スレッドを許可するメソッドのオーバー ロードします。The following code example uses the SignalAndWait(WaitHandle, WaitHandle) method overload to allow the main thread to signal a blocked thread and then wait until the thread finishes a task.

例では、5 つのスレッドを開始し、ブロックすることができます、EventWaitHandleで作成された、EventResetMode.AutoResetフラグ、ユーザーが ENTER キーを押したリリース 1 つのスレッドの時間。The example starts five threads and allows them to block on an EventWaitHandle created with the EventResetMode.AutoReset flag, then releases one thread each time the user presses the ENTER key. 例では、別の 5 つのスレッドのキューし、すべてを使用して、解放、EventWaitHandleで作成された、EventResetMode.ManualResetフラグ。The example then queues another five threads and releases them all using an EventWaitHandle created with the EventResetMode.ManualReset flag.

using namespace System;
using namespace System::Threading;

public ref class Example
{
private:
   // The EventWaitHandle used to demonstrate the difference
   // between AutoReset and ManualReset synchronization events.
   //
   static EventWaitHandle^ ewh;

   // A counter to make sure all threads are started and
   // blocked before any are released. A Long is used to show
   // the use of the 64-bit Interlocked methods.
   //
   static __int64 threadCount = 0;

   // An AutoReset event that allows the main thread to block
   // until an exiting thread has decremented the count.
   //
   static EventWaitHandle^ clearCount =
      gcnew EventWaitHandle( false,EventResetMode::AutoReset );

public:
   [MTAThread]
   static void main()
   {
      // Create an AutoReset EventWaitHandle.
      //
      ewh = gcnew EventWaitHandle( false,EventResetMode::AutoReset );
      
      // Create and start five numbered threads. Use the
      // ParameterizedThreadStart delegate, so the thread
      // number can be passed as an argument to the Start
      // method.
      for ( int i = 0; i <= 4; i++ )
      {
         Thread^ t = gcnew Thread(
            gcnew ParameterizedThreadStart( ThreadProc ) );
         t->Start( i );
      }
      
      // Wait until all the threads have started and blocked.
      // When multiple threads use a 64-bit value on a 32-bit
      // system, you must access the value through the
      // Interlocked class to guarantee thread safety.
      //
      while ( Interlocked::Read( threadCount ) < 5 )
      {
         Thread::Sleep( 500 );
      }

      // Release one thread each time the user presses ENTER,
      // until all threads have been released.
      //
      while ( Interlocked::Read( threadCount ) > 0 )
      {
         Console::WriteLine( L"Press ENTER to release a waiting thread." );
         Console::ReadLine();
         
         // SignalAndWait signals the EventWaitHandle, which
         // releases exactly one thread before resetting,
         // because it was created with AutoReset mode.
         // SignalAndWait then blocks on clearCount, to
         // allow the signaled thread to decrement the count
         // before looping again.
         //
         WaitHandle::SignalAndWait( ewh, clearCount );
      }
      Console::WriteLine();
      
      // Create a ManualReset EventWaitHandle.
      //
      ewh = gcnew EventWaitHandle( false,EventResetMode::ManualReset );
      
      // Create and start five more numbered threads.
      //
      for ( int i = 0; i <= 4; i++ )
      {
         Thread^ t = gcnew Thread(
            gcnew ParameterizedThreadStart( ThreadProc ) );
         t->Start( i );
      }
      
      // Wait until all the threads have started and blocked.
      //
      while ( Interlocked::Read( threadCount ) < 5 )
      {
         Thread::Sleep( 500 );
      }

      // Because the EventWaitHandle was created with
      // ManualReset mode, signaling it releases all the
      // waiting threads.
      //
      Console::WriteLine( L"Press ENTER to release the waiting threads." );
      Console::ReadLine();
      ewh->Set();

   }

   static void ThreadProc( Object^ data )
   {
      int index = static_cast<Int32>(data);

      Console::WriteLine( L"Thread {0} blocks.", data );
      // Increment the count of blocked threads.
      Interlocked::Increment( threadCount );
      
      // Wait on the EventWaitHandle.
      ewh->WaitOne();

      Console::WriteLine( L"Thread {0} exits.", data );
      // Decrement the count of blocked threads.
      Interlocked::Decrement( threadCount );
      
      // After signaling ewh, the main thread blocks on
      // clearCount until the signaled thread has
      // decremented the count. Signal it now.
      //
      clearCount->Set();
   }
};
using System;
using System.Threading;

public class Example
{
    // The EventWaitHandle used to demonstrate the difference
    // between AutoReset and ManualReset synchronization events.
    //
    private static EventWaitHandle ewh;

    // A counter to make sure all threads are started and
    // blocked before any are released. A Long is used to show
    // the use of the 64-bit Interlocked methods.
    //
    private static long threadCount = 0;

    // An AutoReset event that allows the main thread to block
    // until an exiting thread has decremented the count.
    //
    private static EventWaitHandle clearCount = 
        new EventWaitHandle(false, EventResetMode.AutoReset);

    [MTAThread]
    public static void Main()
    {
        // Create an AutoReset EventWaitHandle.
        //
        ewh = new EventWaitHandle(false, EventResetMode.AutoReset);

        // Create and start five numbered threads. Use the
        // ParameterizedThreadStart delegate, so the thread
        // number can be passed as an argument to the Start 
        // method.
        for (int i = 0; i <= 4; i++)
        {
            Thread t = new Thread(
                new ParameterizedThreadStart(ThreadProc)
            );
            t.Start(i);
        }

        // Wait until all the threads have started and blocked.
        // When multiple threads use a 64-bit value on a 32-bit
        // system, you must access the value through the
        // Interlocked class to guarantee thread safety.
        //
        while (Interlocked.Read(ref threadCount) < 5)
        {
            Thread.Sleep(500);
        }

        // Release one thread each time the user presses ENTER,
        // until all threads have been released.
        //
        while (Interlocked.Read(ref threadCount) > 0)
        {
            Console.WriteLine("Press ENTER to release a waiting thread.");
            Console.ReadLine();

            // SignalAndWait signals the EventWaitHandle, which
            // releases exactly one thread before resetting, 
            // because it was created with AutoReset mode. 
            // SignalAndWait then blocks on clearCount, to 
            // allow the signaled thread to decrement the count
            // before looping again.
            //
            WaitHandle.SignalAndWait(ewh, clearCount);
        }
        Console.WriteLine();

        // Create a ManualReset EventWaitHandle.
        //
        ewh = new EventWaitHandle(false, EventResetMode.ManualReset);

        // Create and start five more numbered threads.
        //
        for(int i=0; i<=4; i++)
        {
            Thread t = new Thread(
                new ParameterizedThreadStart(ThreadProc)
            );
            t.Start(i);
        }

        // Wait until all the threads have started and blocked.
        //
        while (Interlocked.Read(ref threadCount) < 5)
        {
            Thread.Sleep(500);
        }

        // Because the EventWaitHandle was created with
        // ManualReset mode, signaling it releases all the
        // waiting threads.
        //
        Console.WriteLine("Press ENTER to release the waiting threads.");
        Console.ReadLine();
        ewh.Set();
        
    }

    public static void ThreadProc(object data)
    {
        int index = (int) data;

        Console.WriteLine("Thread {0} blocks.", data);
        // Increment the count of blocked threads.
        Interlocked.Increment(ref threadCount);

        // Wait on the EventWaitHandle.
        ewh.WaitOne();

        Console.WriteLine("Thread {0} exits.", data);
        // Decrement the count of blocked threads.
        Interlocked.Decrement(ref threadCount);

        // After signaling ewh, the main thread blocks on
        // clearCount until the signaled thread has 
        // decremented the count. Signal it now.
        //
        clearCount.Set();
    }
}
Imports System
Imports System.Threading

Public Class Example

    ' The EventWaitHandle used to demonstrate the difference
    ' between AutoReset and ManualReset synchronization events.
    '
    Private Shared ewh As EventWaitHandle

    ' A counter to make sure all threads are started and
    ' blocked before any are released. A Long is used to show
    ' the use of the 64-bit Interlocked methods.
    '
    Private Shared threadCount As Long = 0

    ' An AutoReset event that allows the main thread to block
    ' until an exiting thread has decremented the count.
    '
    Private Shared clearCount As New EventWaitHandle(False, _
        EventResetMode.AutoReset)

    <MTAThread> _
    Public Shared Sub Main()

        ' Create an AutoReset EventWaitHandle.
        '
        ewh = New EventWaitHandle(False, EventResetMode.AutoReset)

        ' Create and start five numbered threads. Use the
        ' ParameterizedThreadStart delegate, so the thread
        ' number can be passed as an argument to the Start 
        ' method.
        For i As Integer = 0 To 4
            Dim t As New Thread(AddressOf ThreadProc)
            t.Start(i)
        Next i

        ' Wait until all the threads have started and blocked.
        ' When multiple threads use a 64-bit value on a 32-bit
        ' system, you must access the value through the
        ' Interlocked class to guarantee thread safety.
        '
        While Interlocked.Read(threadCount) < 5
            Thread.Sleep(500)
        End While

        ' Release one thread each time the user presses ENTER,
        ' until all threads have been released.
        '
        While Interlocked.Read(threadCount) > 0
            Console.WriteLine("Press ENTER to release a waiting thread.")
            Console.ReadLine()

            ' SignalAndWait signals the EventWaitHandle, which
            ' releases exactly one thread before resetting, 
            ' because it was created with AutoReset mode. 
            ' SignalAndWait then blocks on clearCount, to 
            ' allow the signaled thread to decrement the count
            ' before looping again.
            '
            WaitHandle.SignalAndWait(ewh, clearCount)
        End While
        Console.WriteLine()

        ' Create a ManualReset EventWaitHandle.
        '
        ewh = New EventWaitHandle(False, EventResetMode.ManualReset)

        ' Create and start five more numbered threads.
        '
        For i As Integer = 0 To 4
            Dim t As New Thread(AddressOf ThreadProc)
            t.Start(i)
        Next i

        ' Wait until all the threads have started and blocked.
        '
        While Interlocked.Read(threadCount) < 5
            Thread.Sleep(500)
        End While

        ' Because the EventWaitHandle was created with
        ' ManualReset mode, signaling it releases all the
        ' waiting threads.
        '
        Console.WriteLine("Press ENTER to release the waiting threads.")
        Console.ReadLine()
        ewh.Set()
        
    End Sub

    Public Shared Sub ThreadProc(ByVal data As Object)
        Dim index As Integer = CInt(data)

        Console.WriteLine("Thread {0} blocks.", data)
        ' Increment the count of blocked threads.
        Interlocked.Increment(threadCount)

        ' Wait on the EventWaitHandle.
        ewh.WaitOne()

        Console.WriteLine("Thread {0} exits.", data)
        ' Decrement the count of blocked threads.
        Interlocked.Decrement(threadCount)

        ' After signaling ewh, the main thread blocks on
        ' clearCount until the signaled thread has 
        ' decremented the count. Signal it now.
        '
        clearCount.Set()
    End Sub
End Class

注釈

EventWaitHandleクラスはスレッドに通知することによって相互通信を使用できます。The EventWaitHandle class allows threads to communicate with each other by signaling. 通常、1 つまたは複数のスレッドをブロック、 EventWaitHandle 、ブロック解除スレッドを呼び出すまで、Setメソッド、1 つまたは複数のブロックされたスレッドを解放します。Typically, one or more threads block on an EventWaitHandle until an unblocked thread calls the Set method, releasing one or more of the blocked threads. スレッドをシグナル状態に、EventWaitHandleし、呼び出すことによって、ブロック、 static (Shared Visual Basic で)WaitHandle.SignalAndWaitメソッド。A thread can signal an EventWaitHandle and then block on it, by calling the static (Shared in Visual Basic) WaitHandle.SignalAndWait method.

注意

EventWaitHandleクラスが名前付きシステム同期イベントへのアクセスを提供します。The EventWaitHandle class provides access to named system synchronization events.

動作、EventWaitHandleをシグナル状態になった状態によって異なります。The behavior of an EventWaitHandle that has been signaled depends on its reset mode. EventWaitHandleで作成された、EventResetMode.AutoResetシグナルを受け取ると、単一の待機スレッドを解放した後に、フラグが自動的にリセットされます。An EventWaitHandle created with the EventResetMode.AutoReset flag resets automatically when signaled, after releasing a single waiting thread. EventResetMode.ManualReset フラグで作成された EventWaitHandle は、その Reset メソッドが呼び出されるまで、シグナル状態のままです。An EventWaitHandle created with the EventResetMode.ManualReset flag remains signaled until its Reset method is called.

自動リセット イベントは、リソースへの排他アクセスを提供します。Automatic reset events provide exclusive access to a resource. 自動リセット イベントが通知を受けたとき、待機中のスレッドがない場合は、スレッドが待機中になるまでシグナル状態のままです。If an automatic reset event is signaled when no threads are waiting, it remains signaled until a thread attempts to wait on it. イベントはスレッドを解放してすぐにリセットされ、以降のスレッドをブロックします。The event releases the thread and immediately resets, blocking subsequent threads.

ゲートのようなイベントは、手動リセットします。Manual reset events are like gates. イベントがシグナル状態ではない場合は、待機しているスレッドがブロックされます。When the event is not signaled, threads that wait on it will block. イベントがシグナル状態に、すべての待機中のスレッドがリリースされたら、およびイベント シグナル状態のままと (後続の待機がならない) になるまでそのResetメソッドが呼び出されます。When the event is signaled, all waiting threads are released, and the event remains signaled (that is, subsequent waits do not block) until its Reset method is called. 手動リセット イベントは他のスレッドを続行する前に、1 つのスレッドは、アクティビティを完了する必要がある場合に役立ちます。Manual reset events are useful when one thread must complete an activity before other threads can proceed.

EventWaitHandle オブジェクトで使用できる、 static(Shared Visual Basic で)WaitHandle.WaitAllWaitHandle.WaitAnyメソッド。EventWaitHandle objects can be used with the static(Shared in Visual Basic) WaitHandle.WaitAll and WaitHandle.WaitAny methods.

詳細については、次を参照してください。、スレッドの相互作用、またはシグナルのセクション、同期プリミティブの概要記事。For more information, see the Thread interaction, or signaling section of the Overview of synchronization primitives article.

コンストラクター

EventWaitHandle(Boolean, EventResetMode) EventWaitHandle(Boolean, EventResetMode) EventWaitHandle(Boolean, EventResetMode) EventWaitHandle(Boolean, EventResetMode)

待機ハンドルの初期状態をシグナル状態に設定するかどうか、および、待機ハンドルが自動的にリセットされるかまたは手動でリセットされるかを指定して、EventWaitHandle クラスの新しいインスタンスを初期化します。Initializes a new instance of the EventWaitHandle class, specifying whether the wait handle is initially signaled, and whether it resets automatically or manually.

EventWaitHandle(Boolean, EventResetMode, String) EventWaitHandle(Boolean, EventResetMode, String) EventWaitHandle(Boolean, EventResetMode, String) EventWaitHandle(Boolean, EventResetMode, String)

この呼び出しの結果として待機ハンドルが作成された場合に待機ハンドルの初期状態をシグナル状態に設定するかどうか、待機ハンドルが自動的にリセットされるかまたは手動でリセットされるか、およびシステムの同期イベントの名前を指定して、EventWaitHandle クラスの新しいインスタンスを初期化します。Initializes a new instance of the EventWaitHandle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, and the name of a system synchronization event.

EventWaitHandle(Boolean, EventResetMode, String, Boolean) EventWaitHandle(Boolean, EventResetMode, String, Boolean) EventWaitHandle(Boolean, EventResetMode, String, Boolean) EventWaitHandle(Boolean, EventResetMode, String, Boolean)

EventWaitHandle クラスの新しいインスタンスを初期化し、待機ハンドルがこの呼び出しの結果として作成された場合に最初にシグナル状態になるかどうか、リセットは自動または手動か、システムの同期イベントの名前、呼び出しの後の値で名前の付いたシステム イベントが作成されたかどうかを示すブール値変数を指定します。Initializes a new instance of the EventWaitHandle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, and a Boolean variable whose value after the call indicates whether the named system event was created.

EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity) EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity) EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity) EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity)

EventWaitHandle クラスの新しいインスタンスを初期化し、待機ハンドルがこの呼び出しの結果として作成された場合に最初にシグナル状態になるかどうか、リセットは自動または手動か、システムの同期イベントの名前、呼び出しの後の値で名前の付いたシステム イベントが作成されたかどうかを示すブール値変数、および名前の付いたシステム イベントが作成された場合は、そのイベントにアクセス制御セキュリティを適用するかどうかを指定します。Initializes a new instance of the EventWaitHandle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, the name of a system synchronization event, a Boolean variable whose value after the call indicates whether the named system event was created, and the access control security to be applied to the named event if it is created.

メソッド

Close() Close() Close() Close()

現在の WaitHandle によって保持されているすべてのリソースを解放します。Releases all resources held by the current WaitHandle.

(Inherited from WaitHandle)
CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

WaitHandle クラスの現在のインスタンスによって使用されているすべてのリソースを解放します。Releases all resources used by the current instance of the WaitHandle class.

(Inherited from WaitHandle)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

派生クラスでオーバーライドされると、WaitHandle によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。When overridden in a derived class, releases the unmanaged resources used by the WaitHandle, and optionally releases the managed resources.

(Inherited from WaitHandle)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetAccessControl() GetAccessControl() GetAccessControl() GetAccessControl()

現在の EventWaitHandleSecurity オブジェクトによって表される名前付きシステム イベントのアクセス制御セキュリティを表す EventWaitHandle オブジェクトを取得します。Gets an EventWaitHandleSecurity object that represents the access control security for the named system event represented by the current EventWaitHandle object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

このインスタンスの有効期間ポリシーを制御する有効期間サービス オブジェクトを取得します。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

現在の MarshalByRefObject オブジェクトの簡易コピーを作成します。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
OpenExisting(String) OpenExisting(String) OpenExisting(String) OpenExisting(String)

既に存在する場合は、指定した名前付き同期イベントを開きます。Opens the specified named synchronization event, if it already exists.

OpenExisting(String, EventWaitHandleRights) OpenExisting(String, EventWaitHandleRights) OpenExisting(String, EventWaitHandleRights) OpenExisting(String, EventWaitHandleRights)

これが既に存在する場合は、必要なセキュリティ アクセスで指定した名前付き同期イベントを開きます。Opens the specified named synchronization event, if it already exists, with the desired security access.

Reset() Reset() Reset() Reset()

イベントの状態を非シグナル状態に設定し、スレッドをブロックします。Sets the state of the event to nonsignaled, causing threads to block.

Set() Set() Set() Set()

イベントの状態をシグナル状態に設定し、待機している 1 つ以上のスレッドが進行できるようにします。Sets the state of the event to signaled, allowing one or more waiting threads to proceed.

SetAccessControl(EventWaitHandleSecurity) SetAccessControl(EventWaitHandleSecurity) SetAccessControl(EventWaitHandleSecurity) SetAccessControl(EventWaitHandleSecurity)

名前付きシステム イベントのアクセス制御セキュリティを設定します。Sets the access control security for a named system event.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)
TryOpenExisting(String, EventWaitHandle) TryOpenExisting(String, EventWaitHandle) TryOpenExisting(String, EventWaitHandle) TryOpenExisting(String, EventWaitHandle)

既に存在する場合は、指定した名前付き同期イベントを開き操作が成功したかどうかを示す値を返します。Opens the specified named synchronization event, if it already exists, and returns a value that indicates whether the operation succeeded.

TryOpenExisting(String, EventWaitHandleRights, EventWaitHandle) TryOpenExisting(String, EventWaitHandleRights, EventWaitHandle) TryOpenExisting(String, EventWaitHandleRights, EventWaitHandle) TryOpenExisting(String, EventWaitHandleRights, EventWaitHandle)

既に存在する場合は、必要なセキュリティ アクセスを使って指定した名前付き同期イベントを開き、操作が成功したかどうかを示す値を返します。Opens the specified named synchronization event, if it already exists, with the desired security access, and returns a value that indicates whether the operation succeeded.

WaitOne() WaitOne() WaitOne() WaitOne()

現在の WaitHandle がシグナルを受け取るまで、現在のスレッドをブロックします。Blocks the current thread until the current WaitHandle receives a signal.

(Inherited from WaitHandle)
WaitOne(Int32) WaitOne(Int32) WaitOne(Int32) WaitOne(Int32)

32 ビット符号付き整数を使用して時間間隔をミリ秒単位で指定し、現在の WaitHandle がシグナルを受信するまで、現在のスレッドをブロックします。Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval in milliseconds.

(Inherited from WaitHandle)
WaitOne(Int32, Boolean) WaitOne(Int32, Boolean) WaitOne(Int32, Boolean) WaitOne(Int32, Boolean)

現在の WaitHandle がシグナルを受信するまで現在のスレッドをブロックします。時間間隔を指定するために 32 ビット符号付き整数を使用し、待機の前でも同期ドメインを終了するかどうかを指定します。Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval and specifying whether to exit the synchronization domain before the wait.

(Inherited from WaitHandle)
WaitOne(TimeSpan) WaitOne(TimeSpan) WaitOne(TimeSpan) WaitOne(TimeSpan)

TimeSpan を使用して時間間隔を指定し、現在のインスタンスがシグナルを受信するまで現在のスレッドをブロックします。Blocks the current thread until the current instance receives a signal, using a TimeSpan to specify the time interval.

(Inherited from WaitHandle)
WaitOne(TimeSpan, Boolean) WaitOne(TimeSpan, Boolean) WaitOne(TimeSpan, Boolean) WaitOne(TimeSpan, Boolean)

現在のインスタンスがシグナルを受信するまで現在のスレッドをブロックします。TimeSpan を使用して時間間隔を指定し、待機の前でも同期ドメインを終了するかどうかを指定します。Blocks the current thread until the current instance receives a signal, using a TimeSpan to specify the time interval and specifying whether to exit the synchronization domain before the wait.

(Inherited from WaitHandle)

プロパティ

Handle Handle Handle Handle

ネイティブ オペレーティング システム ハンドルを取得または設定します。Gets or sets the native operating system handle.

(Inherited from WaitHandle)
SafeWaitHandle SafeWaitHandle SafeWaitHandle SafeWaitHandle

ネイティブ オペレーティング システム ハンドルを取得または設定します。Gets or sets the native operating system handle.

(Inherited from WaitHandle)

明示的なインターフェイスの実装

IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()

WaitHandle によって使用されているすべてのリソースを解放します。Releases all resources used by the WaitHandle.

(Inherited from WaitHandle)

フィールド

WaitTimeout WaitTimeout WaitTimeout WaitTimeout

待機ハンドルがシグナル状態になる前に WaitAny(WaitHandle[], Int32, Boolean) 操作がタイムアウトになったことを示します。Indicates that a WaitAny(WaitHandle[], Int32, Boolean) operation timed out before any of the wait handles were signaled. このフィールドは定数です。This field is constant.

(Inherited from WaitHandle)

Extension Methods

GetAccessControl(EventWaitHandle) GetAccessControl(EventWaitHandle) GetAccessControl(EventWaitHandle) GetAccessControl(EventWaitHandle)
SetAccessControl(EventWaitHandle, EventWaitHandleSecurity) SetAccessControl(EventWaitHandle, EventWaitHandleSecurity) SetAccessControl(EventWaitHandle, EventWaitHandleSecurity) SetAccessControl(EventWaitHandle, EventWaitHandleSecurity)
GetSafeWaitHandle(WaitHandle) GetSafeWaitHandle(WaitHandle) GetSafeWaitHandle(WaitHandle) GetSafeWaitHandle(WaitHandle)

ネイティブ オペレーティング システムの待機ハンドルのためのセーフ ハンドルを取得します。Gets the safe handle for a native operating system wait handle.

SetSafeWaitHandle(WaitHandle, SafeWaitHandle) SetSafeWaitHandle(WaitHandle, SafeWaitHandle) SetSafeWaitHandle(WaitHandle, SafeWaitHandle) SetSafeWaitHandle(WaitHandle, SafeWaitHandle)

ネイティブ オペレーティング システムの待機ハンドルのためのセーフ ハンドルを設定します。Sets a safe handle for a native operating system wait handle.

適用対象

スレッド セーフ

この型はスレッド セーフです。This type is thread safe.

こちらもご覧ください