Example #1
0
        //---------------------------------------------------------------------
        public TimerShaft()
        {
            MapEventNode = new Dictionary <EbTimeEvent, EbDoubleLinkNode <EbTimeEvent> >();
            ExcuteList   = new EbDoubleLinkList <EbTimeEvent>();

            mWheel1 = new EbTimeWheel((int)MAX_WHEEL_SIZE);
            mWheel2 = new EbTimeWheel((int)MIN_WHEEL_SIZE);
            mWheel3 = new EbTimeWheel((int)MIN_WHEEL_SIZE);
            mWheel4 = new EbTimeWheel((int)MIN_WHEEL_SIZE);
            mWheel5 = new EbTimeWheel((int)MIN_WHEEL_SIZE);
        }
Example #2
0
        //---------------------------------------------------------------------
        // 调整时间轮上的事件
        int _cascadeTimer(EbTimeWheel timer_wheel, int wheel_index)
        {
            int index = (int)((mTimeJeffies >> (Convert.ToInt32(MAX_WHEEL) + wheel_index * Convert.ToInt32(MIN_WHEEL))) & MIN_WHEEL_MASK);

            EbDoubleLinkNode <EbTimeEvent> head, curr, next;

            head = timer_wheel.GetSpokeHead(index);
            curr = head.next;

            while (curr != head)
            {
                next = curr.next;

                _delTimer(curr);
                _addTimer(curr);

                curr = next;
            }

            return(index);
        }