MCPcopy Index your code
hub / github.com/RustPython/RustPython / add_done_callback

Method add_done_callback

Lib/concurrent/futures/_base.py:408–426  ·  view source on GitHub ↗

Attaches a callable that will be called when the future finishes. Args: fn: A callable that will be called with this future as its only argument when the future completes or is cancelled. The callable will always be called by a thread in the same

(self, fn)

Source from the content-addressed store, hash-verified

406 return self._result
407
408 def add_done_callback(self, fn):
409 """Attaches a callable that will be called when the future finishes.
410
411 Args:
412 fn: A callable that will be called with this future as its only
413 argument when the future completes or is cancelled. The callable
414 will always be called by a thread in the same process in which
415 it was added. If the future has already completed or been
416 cancelled then the callable will be called immediately. These
417 callables are called in the order that they were added.
418 """
419 with self._condition:
420 if self._state not in [CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED]:
421 self._done_callbacks.append(fn)
422 return
423 try:
424 fn(self)
425 except Exception:
426 LOGGER.exception('exception calling callback for %r', self)
427
428 def result(self, timeout=None):
429 """Return the result of the call that the future represents.

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
exceptionMethod · 0.45

Tested by

no test coverage detected