C++ (Qt)while (sleepMs > 0) { int step = qMin(sleepMs, sleepStep); sleepMs -= step; if (abortFlag) ... sleep(step);}