BclExtras.Threading.ActiveOperation.Completed C# (CSharp) Метод

Completed() приватный Метод

Called when the operation complete
private Completed ( ) : void
Результат void
        internal void Completed()
        {
            // It's possible that this is called more than once.  Take the condition
            // where we are in the middle of an OnComplete cycle, then a ThreadAbortedException
            // occurrs.  We would then move into OnErrored so guard against this.
            if (0 == Interlocked.CompareExchange(ref m_hasCompleted, 1, 0))
            {
                try
                {
                    ManualResetEvent mre = m_event;
                    if (null != mre)
                    {
                        mre.Set();
                    }
                }
                catch (ObjectDisposedException)
                {
                    // A race condition exists where we could get a reference to disposed
                    // event so guard against it.  It's not an error since the disposer of
                    // the event is responsible for taking care of the implications of the
                    // dipsose
                }
            }
        }

Usage Example

Пример #1
0
 /// <summary>
 /// Called when the running of a Future is aborted for whatever reason
 /// </summary>
 public void RunAborted()
 {
     CheckForDoubleRun();
     Interlocked.Exchange(ref m_aborted, 1);
     m_op.Completed();
     OnFutureCompleted();
 }