I'm looking for a brief example on the use of What is the correct practice? PS: I This is almost right with one exception Note that your code is almost like an example. Documentation is the best source of short instances. You should call QThreadPool . Here's how I have used it:
Koothhidpool * thread_pull = QuthHadPull :: Global instances (); MyThread * thread = new MyThread (); Thread_pool-> Start (thread); Class MyThread: Public QRunnable {Public: MyThread (); ~ MyThread (); Running zero (); }; Zero MyThread :: Run () {qDebug () & lt; & Lt; "MyThread"; }
wait in context, when should I call
waitForDone ?
QRunnable is not a thread, And you should not call your class
MyThread .
MyRunnable or
MyTask is more correct
waitForDone when you want to wait until all runnabels are processed. It depends on the architecture of your app. Usually this happens when you create and start all
QRunnable s and want to use your results.
No comments:
Post a Comment