public override void Run(){long lastReopenStartNS = DateTime.UtcNow.Ticks * 100;while (!finish){bool hasWaiting;lock (this)hasWaiting = waitingGen > searchingGen;long nextReopenStartNS = lastReopenStartNS + (hasWaiting ? targetMinStaleNS : targetMaxStaleNS);long sleepNS = nextReopenStartNS - Time.NanoTime();if (sleepNS > 0) try { reopenCond.WaitOne(TimeSpan.FromMilliseconds(sleepNS / Time.MILLISECONDS_PER_NANOSECOND)); }catch (ThreadInterruptedException ie){Thread.CurrentThread.Interrupt();return;} if (finish){break;}lastReopenStartNS = Time.NanoTime();refreshStartGen = writer.GetAndIncrementGeneration();try{manager.MaybeRefreshBlocking();}catch (System.IO.IOException ioe){throw new Exception(ioe.ToString(), ioe);}}RefreshDone();}