Example #1
0
 // Internal so it can be overridden in tests
 internal virtual void StartCleanupTimer()
 {
     lock (_cleanupTimerLock)
     {
         if (_cleanupTimer == null)
         {
             _cleanupTimer = NonCapturingTimer.Create(_cleanupCallback, this, DefaultCleanupInterval, Timeout.InfiniteTimeSpan);
         }
     }
 }
        private void StartExpiryTimerSlow(TimerCallback callback)
        {
            Debug.Assert(Lifetime != Timeout.InfiniteTimeSpan);

            lock (_lock)
            {
                if (Volatile.Read(ref _timerInitialized))
                {
                    return;
                }

                _callback         = callback;
                _timer            = NonCapturingTimer.Create(_timerCallback, this, Lifetime, Timeout.InfiniteTimeSpan);
                _timerInitialized = true;
            }
        }