def stop_readout(self, timeout=<NUM_LIT>):
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_readout_threads:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>with self._readout_lock:<EOL><INDENT>self._curr_readout_threads.remove(self.current_module_handle)<EOL><DEDENT>self._stopping_readout_event.clear()<EOL>while not self._stopping_readout_event.wait(<NUM_LIT>):<EOL><INDENT>with self._readout_lock:<EOL><INDENT>if len(set(self._curr_readout_threads) & set([t.name for t in self._scan_threads if t.is_alive()])) == <NUM_LIT:0> or not self._scan_threads or self.abort_run.is_set():<EOL><INDENT>if self.fifo_readout.is_running:<EOL><INDENT>self.fifo_readout.stop(timeout=timeout)<EOL><DEDENT>self._stopping_readout_event.set()<EOL><DEDENT><DEDENT><DEDENT>
Stopping the FIFO readout.

        Stopping of the FIFO readout is executed only once by a random thread.
        Stopping of the FIFO readout is synchronized between all threads reading out the FIFO.