def METHOD_NAME(self, callback):
    """Registers a callback to be invoked when the state changes.
    The callback is invoked immediately with no arguments.  The callback must not block.
    """
    with self.__lock:
        self.__changed_callbacks.add(callback)