public CTask <T> QueueWorkItem <T>(Func <T, int> act) { var task = new CTask <T> { StartTime = DateTime.Now, Action = act, Status = CTaskStatus.NotStart }; _waitingTasks.Enqueue(task); NotifyThreadPoolOfPendingWork(); return(task); }
public List <CTask <T> > QueueWorkItem <T>(IEnumerable <Func <T, int> > acts) { var tasks = new List <CTask <T> >(); foreach (var act in acts.ToArray()) { var task = new CTask <T> { StartTime = DateTime.Now, Action = act, Status = CTaskStatus.NotStart }; _waitingTasks.Enqueue(task); } NotifyThreadPoolOfPendingWork(); return(tasks); }