What is the meaning of Thread affinity?
I'm reading the Qt Documentation and get stuck at thread affinity.
Can anybody explain it to me?
Thanks for reding this.
When a signal is emitted, Qt will call the slot function. Qt needs to choose a thread to run the function.
There are two ways to describe how Qt chooses the thread:
- If the receiver QObject has an affinity for Thread B, then the slot function runs in Thread B.
- If the receiver QObject lives in Thread B, then the slot function runs in Thread B.
You can change the QObject's thread affinity by calling
Thank you very much I think now I understood it. Thanks for the help.