Mine
public text v1 · immutable public static void StartAsync()
{
DateTime started = DateTime.Now;
DateTime ended;
EndedArgs ea;
SmartThreadPool stp = new SmartThreadPool();
if(OnStarted != null)
{
OnStarted();
}
WorkItemCallback wic = new WorkItemCallback(processImportLoop);
for(int i = 0; i < stp.MaxThreads; ++i)
stp.QueueWorkItem(wic);
stp.WaitForIdle();
ended = DateTime.Now;
stp.Shutdown();
if(OnEnded != null)
{
ea = new EndedArgs();
ea.ImportDuration = ended - started;
OnEnded(ea);
}
}