ChildProcessMaster::handleConnectionLost() not on background thread


#1

The notification of a broken connection is occurring on the message thread instead of a background thread. This is due to ChildProcessMaster::Connection being a ChildProcessPingThread, which performs its pings on a background thread as expected, but handles a broken connection via inheritance from an AsyncUpdater, which ultimately posts its notification on the message thread. Wouldn’t it be better to have handleConnectionLost() called from a background thread too (e.g. the ping thread)?


#2

Not sure why you think another thread would be better… The pings are done like that to make sure it always carries on running, but generally it’s easier to write code when events are all delivered and handled by the message thread.


#3

Ok, my ChildProcessMaster was sending a request to the slave on the message thread, and waiting for the answer to be sent back. Which usually only takes a few milliseconds, unless, of course, the slave crashes. So I’ll do the whole thing on a background thread now.