From bb3eb7156f3bf8a4446ac93b8bcd73c33d16e181 Mon Sep 17 00:00:00 2001 From: Andre Merzky Date: Tue, 15 Oct 2024 22:57:59 +0200 Subject: [PATCH] add bridge wait --- src/radical/utils/zmq/bridge.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/radical/utils/zmq/bridge.py b/src/radical/utils/zmq/bridge.py index 24b554ef..ba7a9ffa 100644 --- a/src/radical/utils/zmq/bridge.py +++ b/src/radical/utils/zmq/bridge.py @@ -142,6 +142,21 @@ def start(self): self._log.info('started bridge %s', self._uid) + # -------------------------------------------------------------------------- + # + def wait(self, timeout=None): + ''' + wait for the bridge to terminate. If `timeout` is set, the call will + return after that many seconds, with a return value indicating whether + the bridge is still alive. + ''' + + self._bridge_thread.join(timeout=timeout) + + if timeout is not None: + return not self._bridge_thread.is_alive() + + # -------------------------------------------------------------------------- # @staticmethod