vendredi 26 février 2016

exit during long sleep

Whats the easiest way to exit this While loop while its still sleeping? is there some kind of function that can detect if a value is true while sleeping? or do i set up a small sleep in a loop and check to exit if not sleep some more? if so how would i do that?

        while (_execute.load(std::memory_order_acquire)) 
        {
            //do stuff

            //How to exit druing this long sleep
            std::this_thread::sleep_for(std::chrono::minutes(_Delay));
        }

Aucun commentaire:

Enregistrer un commentaire