Adds a callback to be completed once future is done :param fn: A callable that takes no arguments. Note that is different than concurrent.futures.Future.add_done_callback that requires a single argument for the future.
(self, fn)
| 523 | return self._future.result() |
| 524 | |
| 525 | def add_done_callback(self, fn): |
| 526 | """Adds a callback to be completed once future is done |
| 527 | |
| 528 | :param fn: A callable that takes no arguments. Note that is different |
| 529 | than concurrent.futures.Future.add_done_callback that requires |
| 530 | a single argument for the future. |
| 531 | """ |
| 532 | |
| 533 | # The done callback for concurrent.futures.Future will always pass a |
| 534 | # the future in as the only argument. So we need to create the |
| 535 | # proper signature wrapper that will invoke the callback provided. |
| 536 | def done_callback(future_passed_to_callback): |
| 537 | return fn() |
| 538 | |
| 539 | self._future.add_done_callback(done_callback) |
| 540 | |
| 541 | def done(self): |
| 542 | return self._future.done() |
no outgoing calls