Skip to content

Commit cc52508

Browse files
committed
util: CallbackManager: add comment how unregister_callback could race
1 parent e858b94 commit cc52508

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

electrum/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,8 @@ def register_callback(self, cb: Callable, events: Sequence[str]) -> None:
20132013
self._wcallbacks[event].add(wcb)
20142014

20152015
def unregister_callback(self, cb: Callable) -> None:
2016+
# FIXME if trigger_callback() was just called for this cb, it could race so that
2017+
# the cb gets code exec *after* unregister_callback() returns.
20162018
wcb = self._wcb_from_any_callback(cb)
20172019
with self.callback_lock:
20182020
# note: ^ callback_lock needs to be re-entrant, as we can now trigger __del__, which also takes the lock

0 commit comments

Comments
 (0)