Suppose you have classes A, B and C that live in the main thread. Classes A and B are connected to C's statusChanged(bool) signal. C is triggered from outside thread to emit the signal. Considering A and B live in the same thread, how does event loop process signals in this case? Am I right to expect that both A's and B's slots will be called before the event loop starts processing next signal?
For example, if C is triggered twise from outside to emit signals statusChanged(true) and StatusChanged(false), is there a possibility that event loop triggers A's slot with "true" and then "false" and B's slot with "false" and then "true"?
When signals are emitted from the threads different from the one the receiver lives in, the Qt::QueuedConnection is used. As AhmedAEK answered in the comments under the question, "emit" is thread-safe but not atomic. Therefore, if we need the slots to be synchronized with each other regarding the signals they are processing, we need to synchronize access to "emit" from different threads. In other words, this case
is there a possibility that event loop triggers A's slot with "true" and then "false" and B's slot with "false" and then "true"?
is possible if access to the emit of this signal is not synchronized and impossible otherwise.