Exemplo n.º 1
0
        public void Add(WheelTimerEvent te, int period)
        {
            int addToSlotIndex = currSlotIndex + period;

            if (addToSlotIndex >= slotsLen)
            {
                addToSlotIndex -= slotsLen;
            }

            var addToSlot = slots[addToSlotIndex];

            if (addToSlot.Set(te))
            {
                te.OwnerSlotIndex = addToSlotIndex;
            }
        }
Exemplo n.º 2
0
        public void Active(WheelTimerEvent te, int period)
        {
            int addToSlotIndex = currSlotIndex + period;

            if (addToSlotIndex >= slotsLen)
            {
                addToSlotIndex -= slotsLen;
            }

            if (te.OwnerSlotIndex == addToSlotIndex)
            {
                return;
            }

            if (Remove(te))
            {
                Add(te, period);
            }
        }
Exemplo n.º 3
0
        public bool Remove(WheelTimerEvent te)
        {
            var ownerSlot = slots[te.OwnerSlotIndex];

            return(ownerSlot.Remove(te));
        }
Exemplo n.º 4
0
        public bool Remove(WheelTimerEvent timerEvent)
        {
            WheelTimerEvent dummy = null;

            return(events.TryRemove(timerEvent, out dummy));
        }
Exemplo n.º 5
0
 public bool Set(WheelTimerEvent timerEvent)
 {
     return(events.TryAdd(timerEvent, timerEvent));
 }