On Fri, Feb 6, 2015 at 12:45 PM, Joren Heit
Thanks Tony for the thorough reply. I had just made sure that signals can be (dis)connected by multiple threads in a thread-safe manner, but you are right that there is much more to it. This will be hard to implement I think, but I'll do my best!
One thing I don't quite grasp yet, is the following. Suppose one thread disconnects a slot while another fires a signal connected to that slot. You say that the implementation must make sure that the signal is not fired after the disconnect-call returns. But won't this be undefined behaviour, as there is no way of knowing which will grab the lock first?
Joren
Yes either can grab the lock first. And then you need to do the right thing in either case. If the disconnect grabs the lock first, the signal-firing, once it obtains the lock, can't call the slot. ie either the slot is gone or has been marked null/disconnected/something. If the signal-firing grabs the lock first, no problem.