Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
             */
        }