async void OnTick()

in src/Serilog.Sinks.AzureDataExplorer/Durable/PortableTimer.cs [76:120]


        async void OnTick()
        {
            try
            {
                lock (m_stateLock)
                {
                    if (m_disposed)
                    {
                        return;
                    }

                    // There's a little bit of raciness here, but it's needed to support the
                    // current API, which allows the tick handler to reenter and set the next interval.

                    if (m_running)
                    {
                        Monitor.Wait(m_stateLock);

                        if (m_disposed)
                        {
                            return;
                        }
                    }

                    m_running = true;
                }

                if (!m_cancel.Token.IsCancellationRequested)
                {
                    await m_onTick(m_cancel.Token);
                }
            }
            catch (OperationCanceledException tcx)
            {
                SelfLog.WriteLine("The timer was canceled during invocation: {0}", tcx);
            }
            finally
            {
                lock (m_stateLock)
                {
                    m_running = false;
                    Monitor.PulseAll(m_stateLock);
                }
            }
        }