Details | |||
---|---|---|---|
Template Parameters |
|
Constructors and Destructors | |
---|---|
Future() Construct a future. |
Public types | |
---|---|
TypedCompletionCallback)(const Future< ResultType > &result_data, void *user_data) | typedefvoid(* Function pointer for a completion callback. |
Public functions | |
---|---|
OnCompletion(TypedCompletionCallback callback, void *user_data) const | void Register a single callback that will be called at most once, when the future is completed. |
OnCompletion(std::function< void(const Future< ResultType > &)> callback) const | void Register a single callback that will be called at most once, when the future is completed. |
result() const | const ResultType * Result of the asynchronous call, or nullptr if the result is still pending. |
void(*TypedCompletionCallback)(constFuture<ResultType>&result_data,void*user_data)
Function pointer for a completion callback.
When we call this, we will send the completed future, along with the user data that you specified when you set up the callback.
Future()
Construct a future.
voidOnCompletion(TypedCompletionCallbackcallback,void*user_data)const
Register a single callback that will be called at most once, when the future is completed.
If you call any OnCompletion() method more than once on the same future, only the most recent callback you registered will be called.
When your callback is called, the user_data that you supplied here will be passed back as the second parameter.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
voidOnCompletion(std::function<void(constFuture<ResultType>&)>callback)const
Register a single callback that will be called at most once, when the future is completed.
If you call any OnCompletion() method more than once on the same future, only the most recent callback you registered will be called.
Details | |||
---|---|---|---|
Parameters |
|
constResultType*result()const
Result of the asynchronous call, or nullptr if the result is still pending.
Allows the API to provide a type-specific interface.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-01-23 UTC.