Struct futures_util::future::RemoteHandle
source · [−]pub struct RemoteHandle<T> { /* private fields */ }
Expand description
The handle to a remote future returned by
remote_handle
. When you drop this,
the remote future will be woken up to be dropped by the executor.
Unwind safety
When the remote future panics, Remote will catch the unwind and transfer it to
the thread where RemoteHandle
is being awaited. This is good for the common
case where Remote is spawned on a threadpool. It is unlikely that other code
in the executor working thread shares mutable data with the spawned future and we
preserve the executor from losing its working threads.
If you run the future locally and send the handle of to be awaited elsewhere, you must be careful with regard to unwind safety because the thread in which the future is polled will keep running after the panic and the thread running the RemoteHandle will unwind.