exec() makes another event loop - but you can think of this as another version of the gui event loop.
I dont think it will be interfering with the running of other threads, and I think it should not be halting the execution of slots in the gui thread.
If you want to be able to block your producer/consumer, I suggest looking at something like this:
void
myclass::slot_block()
{
connect(this, SIGNAL(continue()), &eventLoop, SLOT(quit()));
eventLoop.exec(); // will process signals/slots, but myclass
// will not otherwise execute any more code until the loop is exited
}
void
myclass::slot_continue()
{
emit continue();
}
void
myclass::slot_block()
{
QEventLoop eventLoop;
connect(this, SIGNAL(continue()), &eventLoop, SLOT(quit()));
eventLoop.exec(); // will process signals/slots, but myclass
// will not otherwise execute any more code until the loop is exited
}
void
myclass::slot_continue()
{
emit continue();
}
To copy to clipboard, switch view to plain text mode
ie you need to implement two slots and a signal.
Bookmarks