override public void oneLoop() { int timeIntervalToNextLoop = 0; lock (_excutableList) { if (_excutableList.Count != 0) { traversalAndExcute(true); } if (_excutableList.Count > 0) { OnTimeExecution execution = (OnTimeExecution)_excutableList[0]; if (execution != null) { timeIntervalToNextLoop = (int)(execution.when() - ApplicationEX.GetCurrnSystemMillisecond()); } } maualResetEvent.Reset(); } if (timeIntervalToNextLoop > 0) { maualResetEvent.WaitOne(timeIntervalToNextLoop); } else { maualResetEvent.WaitOne(); } }
public void addExcutable(OnTimeExecution excutable) { lock (_excutableList) { bool inserted = false; //sort by time asc. for (int i = 0; i < _excutableList.Count; i++) { if (excutable.when() < ((OnTimeExecution)_excutableList[i]).when()) { _excutableList.Insert(i, excutable); inserted = true; break; } } if (inserted == false) { _excutableList.Add(excutable); } maualResetEvent.Set(); } }
public void removeExecution(OnTimeExecution execution) { _Loop.removeExcutable(execution); }
public void removeExcutable(OnTimeExecution excutable) { lock (_excutableList) { _excutableList.Remove(excutable); } }
public void addExecution(OnTimeExecution execution) { _Loop.addExcutable(execution); }