Ejemplo n.º 1
0
 /// <summary>
 /// Stop the update thread. If the update thread is not running, silently does
 /// nothing. This method returns after the update thread has stopped.
 /// </summary>
 public virtual void StopUpdateThread()
 {
     UninterruptableMonitor.Enter(syncLock);
     try
     {
         if (updateThread != null)
         {
             // this will trigger the thread to terminate if it awaits the lock.
             // otherwise, if it's in the middle of replication, we wait for it to
             // stop.
             updateThread.stop.Signal();
             try
             {
                 updateThread.Join();
             }
             catch (Exception ie) when(ie.IsInterruptedException())
             {
                 Thread.CurrentThread.Interrupt();
                 throw new Util.ThreadInterruptedException(ie);
             }
         }
         updateThread = null;
     }
     finally
     {
         UninterruptableMonitor.Exit(syncLock);
     }
 }