Пример #1
0
 public void StopPoolWithThreadThatHasNotYetStarted()
 {
     using (var pool = new ThreadPool(syncObjectsFactory))
     {
         pool.CreateThread(t => { });
         pool.StopAllThreads(new ThreadPoolStopSettings());
     }
 }
Пример #2
0
 public void CreateAndDestroyEmptyPool()
 {
     using (var pool = new ThreadPool(syncObjectsFactory))
     {
         Assert.IsNotNull(pool);
         pool.StopAllThreads(new ThreadPoolStopSettings());
     }
 }
Пример #3
0
 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);
     }
 }