System.Net.TimerThread.TimerQueue.Fire C# (CSharp) Method

Fire() private method

Called by the timer thread to fire the expired timers. Returns true if there are future timers in the queue, and if so, also sets nextExpiration.

private Fire ( int &nextExpiration ) : bool
nextExpiration int
return bool
            internal bool Fire(out int nextExpiration)
            {
                while (true)
                {
                    // Check if we got to the end.  If so, free the handle.
                    TimerNode timer = _timers.Next;
                    if (timer == _timers)
                    {
                        lock (_timers)
                        {
                            timer = _timers.Next;
                            if (timer == _timers)
                            {
                                if (_thisHandle != IntPtr.Zero)
                                {
                                    ((GCHandle)_thisHandle).Free();
                                    _thisHandle = IntPtr.Zero;
                                }

                                nextExpiration = 0;
                                return false;
                            }
                        }
                    }

                    if (!timer.Fire())
                    {
                        nextExpiration = timer.Expiration;
                        return true;
                    }
                }
            }
        }
TimerThread.TimerQueue