Ejemplo n.º 1
0
        public TimerManager()
        {
            for (int i = 0; i < 5; i++)
            {
                timerWheels[i] = new TimerListWheel();
            }

            UInt64 now = TickerContext.GetTick();

            timerWheels[0].Init(1, 0, null, timerWheels[1], now);
            timerWheels[1].Init(0xff + 1, 8, timerWheels[0], timerWheels[2], now);
            timerWheels[2].Init(0xffff + 1, 16, timerWheels[1], timerWheels[3], now);
            timerWheels[3].Init(0xffffff + 1, 24, timerWheels[2], timerWheels[4], now);
            timerWheels[4].Init((UInt64)0xffffffff + 1, 32, timerWheels[3], null, now);
        }
Ejemplo n.º 2
0
        public void Init(UInt64 msUnit, int bitSize,
                         TimerListWheel smallerWheel, TimerListWheel biggerWheel, UInt64 now)
        {
            this.msUint       = msUnit;
            this.bitSize      = bitSize;
            this.smallerWheel = smallerWheel;
            this.biggerWheel  = biggerWheel;

            if (msUnit == 1)
            {
                baseTick = now;
            }
            else
            {
                baseTick = now + msUnit;
            }
        }