If you aren't using multiple thread and if you can assure no reentrancy then there is chance that this following method will also work for you
Again stressing the fact that this will fail miserably if there is chance of you calling the manualPause function while it is already in progress.
Probably you can disable the buttons/control widgets when the manualPause is in progress. (also function using manualPause won't be reentrant)
enum State
{
Paused,
Run
};
State state;
/** This function won't return till the time delay */
void manualPause()
{
state = Paused;
QTimer::singleShot(delay,
this,
SLOT(setRunState
());
while(1) {
qApp->processEvents();
if(state == Run) break;
}
}
void setRunState()
{
state = Run;
}
enum State
{
Paused,
Run
};
State state;
/** This function won't return till the time delay */
void manualPause()
{
state = Paused;
QTimer::singleShot(delay, this, SLOT(setRunState());
while(1) {
qApp->processEvents();
if(state == Run) break;
}
}
void setRunState()
{
state = Run;
}
To copy to clipboard, switch view to plain text mode
Bookmarks