All pastes #61215 Raw Edit

Mine

public text v1 · immutable
#61215 ·published 2006-06-02 22:21 UTC
rendered paste body
		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);
			}
		}