예제 #1
0
        internal protected YieldState addTimeUp(uint time, IEnumerator ie)
        {
            var state = new YieldState(ie, passTime + time);

            times.Add(state);
            times.Sort(_sortTimes);
            return(state);
        }
예제 #2
0
        public void Start(uint ms)
        {
            cancel = false;
            var hub = CothreadHub.Instance;

            hub.CurrentCothread.Timeout = null;
            ie          = hub.current;
            TimeoutTime = ms;
            startTime   = DateTime.Now;
            state       = hub.addTimeUp(ms, this);
        }
예제 #3
0
        static int _sortTimes(YieldState y1, YieldState y2)
        {
            return(y1.WakeTime.CompareTo(y2.WakeTime));

            /*
             * if (y1.WakeTime < y2.WakeTime)
             *      return -1;
             * if (y1.WakeTime > y2.WakeTime)
             *      return 1;
             * return 0;
             */
        }