我想知道qt如何決定哪種調度信號的工作方式。qt發射信號如何將信號與併發線程一起工作
在http://qt-project.org/doc/qt-4.8/threads-qobject.html#signals-and-slots-across-threads 我發現
Auto Connection (default) If the signal is emitted in the thread which the receiving object has affinity then the behavior is the same as the Direct Connection. Otherwise, the behavior is the same as the Queued Connection.
什麼是在這種情況下,意義affinity
?
Qt如何知道哪個線程使用對象的方法來防止信號數據損壞? affinity
線程是創建對象的線程嗎?
的螺紋上的事件:「每個對象與它的父對象具有相同的線程「,這是否意味着在另一個線程中創建子對象會從父對象」繼承「線程」affinity「? – Klaus
您不能在另一個線程上使用對象的父對象。作爲moveToThread狀態的文檔:「這個函數只能將一個對象從當前線程」推送「到另一個線程,它不能將一個對象從任意線程」拉「到當前線程。」 – TheDarkKnight