public void StopPoolWithThreadThatHasNotYetStarted() { using (var pool = new ThreadPool(syncObjectsFactory)) { pool.CreateThread(t => { }); pool.StopAllThreads(new ThreadPoolStopSettings()); } }
public void CreateAndDestroyEmptyPool() { using (var pool = new ThreadPool(syncObjectsFactory)) { Assert.IsNotNull(pool); pool.StopAllThreads(new ThreadPoolStopSettings()); } }
public void StopPoolWithThreadThatDoesNotWantToStop() { using (var pool = new ThreadPool(syncObjectsFactory)) { IThread thread = pool.CreateThread(t => Thread.Sleep(TimeSpan.FromMinutes(1))); thread.Start(); ThreadPoolStopSettings threadPoolStopSettings = new ThreadPoolStopSettings(); threadPoolStopSettings.InitialStoppingTimeout = TimeSpan.Zero; threadPoolStopSettings.MaxStoppingLoops = 1; threadPoolStopSettings.SubsequentStoppingTimeout = TimeSpan.Zero; pool.StopAllThreads(threadPoolStopSettings); } }