Clear() public method

Clears Action callback target.
public Clear ( ) : void
return void
Beispiel #1
0
 protected void Shutdown()
 {
     if (m_ignoreShutdownHandler)
     {
         return;
     }
     //If the caller did not want to be notified on shutdown
     // or they did but the callback failed.
     // clear all callbacks and initiate a disposal.
     if (!m_disposeOnShutdown && !m_disposeAndWaitCallback.TryInvoke())
     {
         m_callback.Clear();
         m_disposeAndWaitCallback.Clear();
         StartDisposal();
     }
 }
Beispiel #2
0
        /// <summary>
        /// Callback from <see cref="SharedTimerScheduler"/>.
        /// </summary>
        /// <param name="state">The time that the callback was signaled.</param>
        private void TimerCallback(DateTime state)
        {
            if (!m_enabled)
            {
                return;
            }

            if (!m_autoReset)
            {
                m_enabled = false;
                m_registeredCallback?.Clear();
            }

            try
            {
                Elapsed?.Invoke(this, new EventArgs <DateTime>(state));
            }
            catch (Exception ex)
            {
                try
                {
                    EventHandler <EventArgs <Exception> > unhandledExceptions = UnhandledExceptions;

                    if ((object)unhandledExceptions == null)
                    {
                        m_log.Publish(MessageLevel.Info, "Swallowed exception", null, null, ex);
                    }
                    else
                    {
                        unhandledExceptions(this, new EventArgs <Exception>(ex));
                    }
                }
                catch (Exception ex2)
                {
                    m_log.Publish(MessageLevel.Warning, MessageFlags.BugReport, "Unhandled Exception callback threw an error", ex2.ToString(), null, ex2);
                }
            }
        }
 public void Dispose()
 {
     m_remoteCallback.Clear();
 }