File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def __init__(self, name: str = "SignalMonitoring"):
2727 self .name = name
2828 self ._signal_instances = {}
2929 self ._callables = {}
30- self ._lock = threading .Lock ()
30+ self ._lock = threading .RLock ()
3131 self ._poll_thread = threading .Thread (target = self ._poll_signals , daemon = True )
3232 self ._kill_event = threading .Event ()
3333 self ._start_poll_event = threading .Event ()
@@ -109,8 +109,10 @@ def stop(self):
109109
110110 def shutdown (self ):
111111 """Shutdown the monitoring thread and clean up resources."""
112- self ._callables .clear ()
113- self ._signal_instances .clear ()
112+ with self ._lock :
113+ self ._callables .clear ()
114+ self ._signal_instances .clear ()
114115 self ._kill_event .set ()
115116 self ._start_poll_event .set () # Ensure the polling thread is not waiting
117+ self ._polling_interval_event .set () # Ensure the polling thread is not waiting
116118 self ._poll_thread .join ()
You can’t perform that action at this time.
0 commit comments