private static void TestFinallyCodeBlockOnThreadWorker() { _worker = new SingleThreadedRelayQueueWorker <Action>(a => a(), ThreadPriority.Normal, true, ApartmentState.Unknown); _worker.AddToExecutionQueue(() => { throw new Exception("oops"); }); _worker.AddToExecutionQueue(() => { throw new Exception("oops"); }); _worker.AddToExecutionQueue(() => { throw new Exception("oops"); }); }
public static void SingleThreadRelayWorkerStressTest() { _worker = new SingleThreadedRelayQueueWorker <Action>(a => a(), ThreadPriority.Normal, true, null); Console.WriteLine("Worker created"); var t1 = new Thread(ThreadStart) { IsBackground = true, Priority = ThreadPriority.BelowNormal }; //var t2 = new Thread(ThreadStart) {IsBackground = true, Priority = ThreadPriority.Normal}; var t3 = new Thread(ThreadStart) { IsBackground = true, Priority = ThreadPriority.Highest }; t1.Start(); //t2.Start(); t3.Start(); Console.WriteLine("All threads started"); }