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