Represents the outcome of a task in the future.
More...
|
| __init__ (self, *executor=None) |
|
| __del__ (self) |
|
| __await__ (self) |
| Yield while the task is not finished.
|
|
| add_done_callback (self, callback) |
| Add a callback to be executed when the task is done.
|
|
| cancel (self) |
| Request cancellation of the running task if it is not done already.
|
|
| cancelled (self) |
| Indicate if the task has been cancelled.
|
|
| done (self) |
| Indicate if the task has finished executing.
|
|
| exception (self) |
| Get an exception raised by a done task.
|
|
| result (self) |
| Get the result of a done task.
|
|
| set_exception (self, exception) |
| Set the exception raised by the task.
|
|
| set_result (self, result) |
| Set the result returned by a task.
|
|
Represents the outcome of a task in the future.
Definition at line 37 of file task.py.
◆ __init__()
rosros.rclify.task.Future.__init__ |
( |
|
self, |
|
|
* |
executor = None |
|
) |
| |
◆ __del__()
rosros.rclify.task.Future.__del__ |
( |
|
self | ) |
|
◆ __await__()
rosros.rclify.task.Future.__await__ |
( |
|
self | ) |
|
Yield while the task is not finished.
Definition at line 63 of file task.py.
◆ _invoke_done_callbacks()
rosros.rclify.task.Future._invoke_done_callbacks |
( |
|
self | ) |
|
|
protected |
Schedule done callbacks on the executor if possible, else run them directly.
This function assumes self._lock is not held.
Definition at line 145 of file task.py.
◆ add_done_callback()
rosros.rclify.task.Future.add_done_callback |
( |
|
self, |
|
|
|
callback |
|
) |
| |
Add a callback to be executed when the task is done.
Callbacks should not raise exceptions.
The callback may be called immediately by this method if the future is already done. If this happens and the callback raises, the exception will be raised by this method.
- Parameters
-
callback | a callback taking the future as an argument to be run when completed |
Definition at line 168 of file task.py.
◆ cancel()
rosros.rclify.task.Future.cancel |
( |
|
self | ) |
|
Request cancellation of the running task if it is not done already.
Definition at line 69 of file task.py.
◆ cancelled()
rosros.rclify.task.Future.cancelled |
( |
|
self | ) |
|
Indicate if the task has been cancelled.
- Returns
- True if the task was cancelled
Definition at line 81 of file task.py.
◆ done()
rosros.rclify.task.Future.done |
( |
|
self | ) |
|
Indicate if the task has finished executing.
- Returns
- True if the task is finished or raised while it was executing
Definition at line 89 of file task.py.
◆ exception()
rosros.rclify.task.Future.exception |
( |
|
self | ) |
|
Get an exception raised by a done task.
- Returns
- the exception raised by the task
Definition at line 109 of file task.py.
◆ result()
rosros.rclify.task.Future.result |
( |
|
self | ) |
|
Get the result of a done task.
- Exceptions
-
- Returns
- The result set by the task
Definition at line 99 of file task.py.
◆ set_exception()
rosros.rclify.task.Future.set_exception |
( |
|
self, |
|
|
|
exception |
|
) |
| |
Set the exception raised by the task.
- Parameters
-
result | the output of a long running task |
Definition at line 130 of file task.py.
◆ set_result()
rosros.rclify.task.Future.set_result |
( |
|
self, |
|
|
|
result |
|
) |
| |
Set the result returned by a task.
- Parameters
-
result | the output of a long running task |
Definition at line 118 of file task.py.
◆ _callbacks
rosros.rclify.task.Future._callbacks |
|
protected |
◆ _cancelled
rosros.rclify.task.Future._cancelled |
|
protected |
◆ _done
rosros.rclify.task.Future._done |
|
protected |
◆ _exception
rosros.rclify.task.Future._exception |
|
protected |
◆ _exception_fetched
rosros.rclify.task.Future._exception_fetched |
|
protected |
◆ _lock
rosros.rclify.task.Future._lock |
|
protected |
◆ _result
rosros.rclify.task.Future._result |
|
protected |
The documentation for this class was generated from the following file: