Unsolved QThreadpool/QRunnable blocking
-
What do you mean by block all execution ?
Whereas my program normally continues running and the slotTask will be triggered almost constantly, the program hangs after the 'hello from thread x' statement.
How did you determine that ?
Output to the console window stops. Execution (and console output) would normally continue until I terminate the program.
Which version of Qt ?
5.9.3 -- not chosen by me, so I'm stuck with it.
On which platform ?
Windows 10
-
Does it block directly on the first tryStart call ?
-
Yes, first tryStart call.
-
How long does it block ?
You're runnable being pretty short and quick to do, you might just see it done sooner that what you expect.
-
This post is deleted! -
@SGaist Execution stops after that.
-
What do you mean by stop ?
Does your application hang or crashes ? -
The application hangs.
-
Made a couple of tweaks and turned on some print statements in a different part of the app (a different slot triggered by QTimer).
It almost looks like slotTask just stops printing to the console and log file.
-
void HelloWorldTask::run() { qDebug() << "Hello world from thread" << QThread::currentThread(); }
@John-Howe Does your implementation contains these statements only in run method? or any while loop ?
-
@John-Howe the
qDebug
stream is serialized internally, which is what @nagesh is alluding to, I imagine. That notwithstanding, you should just interrupt the debugger when the program hangs, and extract a complete stack trace. Upload it somewhere/post it here, so we can take a look.