Interrumpir un hilo dormido

¿Hay alguna manera de interrumpir un hilo dormido? Si tengo un código similar a este.

while(true){
    if(DateTime.Now.Subtract(_lastExecuteTime).TotalHours > 1){
        DoWork();
        _lastExecuteTime = DateTime.Now();
        continue; 
    }
    Thread.Sleep(10000) //Sleep 10 seconds
    if(somethingIndicatingQuit){
        break;
    }

}

Quiero ejecutar DoWork () cada hora. Entonces, me gustaría dormir un poco más de 10 segundos. Decir cheque cada 10 minutos más o menos. Sin embargo, si configuro mi sueño en 10 minutos y quiero finalizar esta tarea en segundo plano, tengo que esperar a que se reanude el sueño.

Mi código real está usando un Threading.ManualResetEvent para cerrar el trabajo en segundo plano, pero mi problema es con el código ThreadSleep. Puedo publicar más código si es necesario.

OK, voy a agregar un código un poco más completo aquí, ya que creo que responderá algunas de las preguntas.

private readonly ManualResetEvent _shutdownEvent = new ManualResetEvent(false);
private readonly ManualResetEvent _pauseEvent = new ManualResetEvent(true);
private Thread _backGroundWorkerThread;

//This starts our work
public void Start() {
    _backGroundWorkerThread = new Thread(ExecuteWorker) {IsBackground = true, Name = WorkerName + "_Thread"};
    _shutdownEvent.Reset();
    _backGroundWorkerThread.Start();
}
internal void Stop() {
    //Signal the shutdown event
    _shutdownEvent.Set();

    //Make sure to resume any paused threads
    _pauseEvent.Set();

    //Wait for the thread to exit
    _backGroundWorkerThread.Join();

}

private void ExecuteWorker() {
    while (true) {
        _pauseEvent.WaitOne(Timeout.Infinite);

        //This kills our process
        if (_shutdownEvent.WaitOne(0)) {
           break;
        }

        if (!_worker.IsReadyToExecute) {
            //sleep 5 seconds before checking again. If we go any longer we keep our service from shutting down when it needs to.
            Thread.Sleep(5000);
            continue;
        }
        DoWork();

    }
}

Mi problema está aquí,

_backGroundWorkerThread.Join();

Esto espera el Thread.Sleep dentro del ExecuteWorker () que se está ejecutando en mi hilo de fondo.

Respuestas a la pregunta(6)

Su respuesta a la pregunta