internal protected YieldState addTimeUp(uint time, IEnumerator ie) { var state = new YieldState(ie, passTime + time); times.Add(state); times.Sort(_sortTimes); return(state); }
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); }
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; */ }