pub struct PollingTaskHandle { /* private fields */ }Expand description
When PollingTaskHandle is dropped, the background thread is signaled to perform a clean exit
at the first available opportunity. If the thread is currently sleeping, this will occur almost
immediately. If the closure is still running, it will happen immediately after the closure
finishes. The task joins on the background thread as a best-effort clean exit. Whether this is a
blocking operation depends on how the handle was configured by PollingTaskBuilder.
If the handle is configured to track exit with timeout and a timeout occurs, the drop will panic!
The tokio variant here is none blocking. Any monitoring is performed by spawning and detaching a new tokio task.
Implementations§
Source§impl PollingTaskHandle
impl PollingTaskHandle
Sourcepub async fn cancel(self) -> Result<(), CancelPollingTaskTimeout>
pub async fn cancel(self) -> Result<(), CancelPollingTaskTimeout>
Cancel the task now, allowing the caller to decide how to handle timeout errors instead of panicking at drop time. If you haven’t configured the handle to monitor for exit with timeout, it’s unlikely that this function is useful.