diff --git a/csaxs_bec/devices/epics/mcs_card/mcs_card_csaxs.py b/csaxs_bec/devices/epics/mcs_card/mcs_card_csaxs.py index 85c0dcd..0ae2b15 100644 --- a/csaxs_bec/devices/epics/mcs_card/mcs_card_csaxs.py +++ b/csaxs_bec/devices/epics/mcs_card/mcs_card_csaxs.py @@ -68,13 +68,14 @@ def suppress_mca_callbacks(mcs_card: MCSCard, restore_after_timeout: None | floa clear the suppression after the specified time. If None, the original state is not restored. """ - mcs_card._omit_mca_callbacks.set() # pylint: disable=protected-access - try: - yield - finally: - if restore_after_timeout is not None: - time.sleep(restore_after_timeout) - mcs_card._omit_mca_callbacks.clear() # pylint: disable=protected-access + with mcs_card._rlock: + mcs_card._omit_mca_callbacks.set() # pylint: disable=protected-access + try: + yield + finally: + if restore_after_timeout is not None: + time.sleep(restore_after_timeout) + mcs_card._omit_mca_callbacks.clear() # pylint: disable=protected-access if TYPE_CHECKING: # pragma: no cover