- class tensorstore.Promise[T]
Handle for producing the result of an asynchronous operation.
A promise represents the producer interface corresponding to a
Future, and may be used to signal the completion of an asynchronous operation.>>> promise, future = ts.Promise.new() >>> future.done() False >>> promise.set_result(5) >>> future.done() True >>> future.result() 5PromiseandFuturecan also be used with type :param >>> promise: :param future = ts.Promise[int].new(): :param >>> typing.assert_type: :type >>> typing.assert_type: promise, ts.Promise[int] :param >>> typing.assert_type: :type >>> typing.assert_type: future, ts.Future[int] :param >>> promise.set_result: :type >>> promise.set_result: 5 :param >>> future.result(): :param 5:See also
Operations¶
- set_result(result: T) None
Marks the linked future as successfully completed with the specified result.
- set_exception(exception: object) None
Marks the linked future as unsuccessfully completed with the specified error.
Constructors¶