System.Threading.TimerBase.Dispose C# (CSharp) Méthode

Dispose() private méthode

private Dispose ( WaitHandle notifyObject ) : bool
notifyObject WaitHandle
Résultat bool
        internal bool Dispose(WaitHandle notifyObject)
        {
            bool status = false;
            bool bLockTaken = false;
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
            }
            finally
            {
                do 
                {
                    if (Interlocked.CompareExchange(ref m_lock, 1, 0) == 0)
                    {
                        bLockTaken = true;
                        try
                        {
                            status = DeleteTimerNative(notifyObject.SafeWaitHandle);
                        }
                        finally
                        {
                            m_lock = 0;
                        }
                    }
                    Thread.SpinWait(1);     // yield to processor
                }
                while (!bLockTaken);
                GC.SuppressFinalize(this);
            }

            return status;
        }

Same methods

TimerBase::Dispose ( ) : void

Usage Example

Exemple #1
0
 public bool Dispose(WaitHandle notifyObject)
 {
     if (notifyObject == null)
     {
         throw new ArgumentNullException("notifyObject");
     }
     return(timerBase.Dispose(notifyObject));
 }