The short answer is there is no need to use eventloop just to make a 'false' block in your code. You could just use signals and slots and refactor your thread code. What you have done is block a thread from potentially doing more work. If that thread *truly* can't do any more work, then I don't think it is doing any harm.
thread code (what you have):
void thread::do_something()
{
do_x();
emit some_signal(); // this is your blocking queued connection
do_some_more_stuff();
}
void thread::do_something()
{
do_x();
emit some_signal(); // this is your blocking queued connection
do_some_more_stuff();
}
To copy to clipboard, switch view to plain text mode
to this:
void thread::do_something_part1()
{
do_x();
emit some_signal();
}
void thread::do_something_part2() // this is a slot. connect it to a signal that is sent when user has 'decided something'
{
do_some_more_stuff();
}
void thread::do_something_part1()
{
do_x();
emit some_signal();
}
void thread::do_something_part2() // this is a slot. connect it to a signal that is sent when user has 'decided something'
{
do_some_more_stuff();
}
To copy to clipboard, switch view to plain text mode
Bookmarks