Esempio n. 1
0
        public void SetComplete(object message, bool completedSynchronously, System.Exception exception)
        {
            if (Interlocked.Increment(ref m_setCompleteCount) == 1)               // prevent possible race conditions in the caller's code
            {
                m_completed = true;
                m_completedSynchronously = completedSynchronously;
                m_message   = message;
                m_context   = CurrentContext.DetachRequestContext();
                m_exception = (exception == null) ? null : exception.GetBaseException();

                if (m_completeEvent != null)
                {
                    ((ManualResetEvent)m_completeEvent).Set();
                }

                if (m_userCallback != null)
                {
                    m_userCallback(this);
                }
            }
        }