Ah yeah in case there's a problem with signals/slots and thread-affinity, together with the foreground-lock I've also added a DO_IN_FOREGROUND macro, which _really_ does the thing in the foreground, and finishes when it's done. Example usage: parseTarget() { collect }