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
}
}
}