Example #1
0
 private void btnStaSynchronizationContext_Click(object sender, EventArgs e)
 {
     mStaSyncContext = new StaSynchronizationContext();
     for (int i = 0; i < 100; i++)
     {
         ThreadPool.QueueUserWorkItem(NonStaThread);
     }
     Console.WriteLine("Processing");
     Console.WriteLine("Press any key to dispose SyncContext");
     Console.ReadLine();
     mStaSyncContext.Dispose();
 }
Example #2
0
 public void Dispose()
 {
     syncContext.Dispose();
     syncContext = null;
 }
Example #3
0
 protected virtual void TearDown()
 {
     syncContext.Dispose();
     syncContext = null;
     Monitor.Exit(LockObj);
 }