def add_done_callback(self, callback, *args):
        """Add a callback that gets called when the future completes.

        The callback will be called in the context of the fiber that sets the
        future's result. The callback is called with the positional arguments
        *args* provided to this method.

        The return value is an opaque handle that can be used with
        :meth:`~gruvi.Future.remove_done_callback` to remove the callback.

        If the future has already completed, then the callback is called
        immediately from this method and the return value will be ``None``.
        """
        with self._lock:
            if self._state not in (self.S_DONE, self.S_EXCEPTION):
                return add_callback(self, callback, args)
        callback(*args)
def add_done_callback ( self , callback , * args ) : with self . _lock : if self . _state not in ( self . S_DONE , self . S_EXCEPTION ) : return add_callback ( self , callback , args ) callback ( * args )
Add a callback that gets called when the future completes.

        The callback will be called in the context of the fiber that sets the
        future's result. The callback is called with the positional arguments
        *args* provided to this method.

        The return value is an opaque handle that can be used with
        :meth:`~gruvi.Future.remove_done_callback` to remove the callback.

        If the future has already completed, then the callback is called
        immediately from this method and the return value will be ``None``.