How to FINALLY do asynchronous background worker with QThread
-
[Spam deleted. Entertaining replies below retained :) --JKSH]
-
I'll save other folks the trouble of clicking the above link by pointing out that there seems to be no "useful new stuff" actually on the site, just an invitation to submit an email address so you can be mailed the info. It's like Tim Berners-Lee had never been born.
-
@mrjj said:
On a site note, it looks very nice and inviting and he made a whole site just to scam people's emails. :)
Hey mrjj,
where have you learned to use QThread correctly?If you all guys found it easily on the net,
then I'd better stop wasting my time, uff.Thanks for feedback.
-
The documentation examples show exactly the two recommended ways: a worker object and subclassing QThread.
For a rationale behind these examples you can refer to this article and its linked predecessor that shows what not to do. -
@Chris-Kawa said:
The documentation examples show exactly the two recommended ways: a worker object and subclassing QThread.
For a rationale behind these examples you can refer to this article and its liknked predecessor that shows what not to do.Thanks for the links Chris,
that's exactly the stuff I had problem with ;) -
I also found this one interresting
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/ -
Hi @Viktor-Jamrich, if you were truly trying to help other users with your website, then I apologize for deleting your post as spam. However, I still recommend posting your notes on the site directly. Asking people for their email addresses is a bit suspicious.
Anyway, to answer your question, see the following items in the official documentation (plus the articles that @Chris-Kawa gave you):
- Multithreading Technologies in Qt -- Qt has many ways of using threads, not just QThread. This article shows you how to choose the best way.
- Synchronizing Threads -- This article talks about how to safely transfer data between threads.
- QObject|Thread Affinity -- This section describes how signals and slots work between threads.
that's exactly the stuff I had problem with ;)
If you still have problems, please feel free to post questions here. I'm confident that the community will help you out.
-
@mrjj said:
I also found this one interresting
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/Please note that the Worker-Object approach described in this blog post is valid if you want to use signals and slots between threads. However, if you don't need signals and slots, then the Worker-Object approach is an overkill.