def exit_sync(self):
if self._scan_threads and self.current_module_handle not in [t.name for t in self._scan_threads]:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>if self._scan_threads and self.current_module_handle not in self._curr_sync_threads:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>with self._sync_lock:<EOL><INDENT>self._curr_sync_threads.remove(self.current_module_handle)<EOL><DEDENT>self._exit_sync_event.clear()<EOL>while not self._exit_sync_event.wait(<NUM_LIT>):<EOL><INDENT>if self.abort_run.is_set():<EOL><INDENT>break<EOL><DEDENT>with self._sync_lock:<EOL><INDENT>if len(set(self._curr_sync_threads) & set([t.name for t in self._scan_threads if t.is_alive()])) == <NUM_LIT:0> or not self._scan_threads:<EOL><INDENT>self._exit_sync_event.set()<EOL><DEDENT><DEDENT><DEDENT>
Waiting for all threads to appear, then continue.