WaitHandle

WaitHandle CF 1.0, ECMA 1.0, marshal by reference, disposable

System.Threading (mscorlib.dll) abstract class

This class encapsulates much of the logic for dealing with synchronization handles, which allow much more fine-grained synchronization control than simple thread locking. Once you have references to one or more WaitHandle subclasses, use the static WaitOne( ) or WaitAny( ) methods to obtain a lock on any single handle or all of the handles, respectively. The WaitOne( ) instance method acquires the lock for a specific WaitHandle . If a thread blocks and cannot obtain the necessary locks, it enters the ThreadState.WaitSleepJoin state until the locks can be obtained.

 public abstract class  WaitHandle  : MarshalByRefObject, IDisposable {  // Public Constructors  public  WaitHandle  ( );  // Public Static Fields  public const int  WaitTimeout  ;  // =258   // Protected Static Fields  protected static readonly IntPtr  InvalidHandle  ;  // =-1   // Public Instance Properties  public virtual IntPtr  Handle  {set; get; }  // Public Static Methods  public static bool  WaitAll  (WaitHandle[ ]   waitHandles   );    public static bool  WaitAll  (WaitHandle[ ]   waitHandles   , int   millisecondsTimeout   , bool   exitContext   );    public static bool  WaitAll  (WaitHandle[ ]   waitHandles   , TimeSpan   timeout   , bool   exitContext   );    public static int  WaitAny  (WaitHandle[ ]   waitHandles   );    public static int  WaitAny  (WaitHandle[ ]   waitHandles   , int   millisecondsTimeout   , bool   exitContext   );    public static int  WaitAny  (WaitHandle[ ]   waitHandles   , TimeSpan   timeout   , bool   exitContext   );  // Public Instance Methods  public virtual void  Close  ( );    public virtual bool  WaitOne  ( );    public virtual bool  WaitOne  (int   millisecondsTimeout   , bool   exitContext   );    public virtual bool  WaitOne  (TimeSpan   timeout   , bool   exitContext   );  // Protected Instance Methods  protected virtual void  Dispose  (bool   explicitDisposing   );    protected override void  Finalize  ( );  // overrides object  } 

Hierarchy

System.Object System.MarshalByRefObject WaitHandle(System.IDisposable)

Subclasses

AutoResetEvent , ManualResetEvent , Mutex

Returned By

System.IAsyncResult.AsyncWaitHandle , System.IO.Stream.CreateWaitHandle( )

Passed To

RegisteredWaitHandle.Unregister( ) , ThreadPool.{RegisterWaitForSingleObject( ) , UnsafeRegisterWaitForSingleObject( )} , Timer.Dispose( )



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net