diff --git a/superxas_bec/devices/timepix/timepix_fly_client/timepix_fly_backend.py b/superxas_bec/devices/timepix/timepix_fly_client/timepix_fly_backend.py index 27ba936..3eda5d3 100644 --- a/superxas_bec/devices/timepix/timepix_fly_client/timepix_fly_backend.py +++ b/superxas_bec/devices/timepix/timepix_fly_client/timepix_fly_backend.py @@ -140,6 +140,12 @@ class TimepixFlyBackend: """Cleanup method to stop all running processes.""" self.timepix_fly_client.shutdown() self._data_thread_shutdown_event.set() + if self._data_thread.is_alive(): + self._data_thread.join(timeout=1) + if self._data_thread.is_alive(): + logger.info( + f"Data thread poll loop of timepix_fly_client did not stop within 1 second." + ) if self._socket_server is not None: try: self._socket_server.close()