次の方法で共有


Wait Handles

Microsoft Silverlight will reach end of support after October 2021. Learn more.

The WaitHandle class is the base class for all synchronization objects in the runtime that allow multiple wait operations. For a comparison of wait handles with other synchronization objects, see Synchronization Primitives.

The WaitHandle class itself is abstract. In addition to serving as a base class, it has a number of static methods that enable waiting on multiple events. In Silverlight, classes derived from WaitHandle include the EventWaitHandle class and its derived classes, AutoResetEvent and ManualResetEvent. See EventWaitHandle, AutoResetEvent, and ManualResetEvent.

Threads can block on an individual wait handle by calling the inherited instance method WaitOne. In addition, the WaitHandle class has overloaded static methods for waiting until all of a specified set of wait handles have been signaled (WaitAll), or waiting until any one of a specified set of wait handles has been signaled (WaitAny). The overloads of these methods provide time-out intervals for abandoning the wait.

The derived classes of WaitHandle can differ in their thread affinity. Event wait handles (EventWaitHandle, AutoResetEvent, and ManualResetEvent) do not have thread affinity. Any thread can signal an event wait handle. In Silverlight, there are no derived classes that have thread affinity.