Example #1
0
        private static void ReturnToPool(int amount, DelayCallTimer head, DelayCallTimer tail)
        {
            tail.Attach(_poolHead);
            _poolHead   = head;
            _poolCount += amount;
#if DEBUG_TIMERS
            logger.Information("Returning to pool. ({Count} / {Capacity})", _poolCount, _poolCapacity);
#endif
        }
Example #2
0
        internal static void RefillPool(int amount, out DelayCallTimer head, out DelayCallTimer tail)
        {
#if DEBUG_TIMERS
            logger.Information("Filling pool with {Amount} timers.", amount);
#endif

            head = null;
            tail = null;

            for (var i = 0; i < amount; i++)
            {
                var timer = new DelayCallTimer(TimeSpan.Zero, TimeSpan.Zero, 0, null);
                timer.Attach(head);

                if (i == 0)
                {
                    tail = timer;
                }

                head = timer;
            }
        }