I am using signals to communicate the status of object between threads. One thread responds to network events and tells the main GUI thread that something has changed. At some point the object is "finalized" -- it will never emit another signal. I'd like to disconnect all handlers at that time to reduce the load on QT's dispatch mechanism*. The question is how can I do this correctly.
If I call "disconnect" will it clear all pending signals, or will it first allow those signals to be sent and then disconnect?
I first though to just send one additional signal called "doDisconnect", but since threads are involved I have no real way of guaranteeing that all previous signals are handled before any thread gets this signal.
Does anybody know of an easy way to this? I'm trying to avoid a timed disconnected (like 10s after last signal) but if nothing else works I do have this option.
*I am creating a lot of objects that have signal activity for a short part of their life. That is, they are created, send 10-20 signals, and then exist for the duration of the application without ever sending another signal.
Bookmarks