internal static void UpdateCache()
{
List<SchedulerTask> newList = new List<SchedulerTask>();
List<SchedulerTask> deletionList = new List<SchedulerTask>();
lock ( TaskListLock ) {
foreach ( SchedulerTask task in Tasks ) {
if ( task.IsStopped ) {
deletionList.Add( task );
} else {
newList.Add( task );
}
}
for ( int i = 0; i < deletionList.Count; i++ ) {
Tasks.Remove( deletionList[i] );
#if DEBUG_SCHEDULER
FireEvent( TaskRemoved, deletionList[i] );
Logger.Log( LogType.Debug,
"Scheduler.UpdateCache: Removed {0}", deletionList[i] );
#endif
}
}
taskCache = newList.ToArray();
}