pub struct WaitMember<'group> { /* private fields */ }Expand description
A wait object owned by a CleanupGroup.
Behaves like ThreadpoolWait but is released by the group rather than by
its own drop, and the watched handle is owned by the group.
Implementations§
Source§impl WaitMember<'_>
impl WaitMember<'_>
Sourcepub fn handle(&self) -> BorrowedHandle<'_>
pub fn handle(&self) -> BorrowedHandle<'_>
Borrow the watched handle, for signalling or inspecting it.
Sourcepub fn arm(&self, timeout: Option<Duration>)
pub fn arm(&self, timeout: Option<Duration>)
Arm the wait, so the next signal or timeout runs the callback once.
Sourcepub fn stop_and_drain(&self)
pub fn stop_and_drain(&self)
Stop watching and block until no callback is queued or executing.
The same drain ThreadpoolWait::stop_and_drain performs, including
suppressing a re-arm a running callback asks for: without that the drain
could return with the object armed again, which is the whole reason the
standalone type has this method rather than only disarm and wait.
Added because a member that lacked it was not the equivalent of its
standalone twin that CleanupGroup::create_wait says it is.
Sourcepub fn try_cancel_pending(&self)
pub fn try_cancel_pending(&self)
Prefer wait.
This crate repairs the pool afterwards – and on a pool whose repair
item could not be created, this call tries to create it rather than
giving up. Only if that fails too does the cancellation proceed with
nothing to repair it, recording cancel-untracked and panicking under
fail-fast. That is what makes this safe to offer. See
README-FEATURE-self-heal.md.
The registry itself is private, so this names it rather than linking it: a public page linking a private item renders a reference the reader cannot follow, which rustdoc warns about.
Sourcepub unsafe fn try_cancel_pending_no_heal_tracking(&self)
pub unsafe fn try_cancel_pending_no_heal_tracking(&self)
try_cancel_pending without the repair.
Not a link, deliberately: the method it would name does not exist in a
build with self-heal off, and this one does, so the link would dangle
in exactly the configuration this method exists for.
Owning the wait through a cleanup group does not change the hazard.
The group’s own Drop is safe because it releases with cancel-pending
false, not because the group protects its members; a cancelling release
passes the cancel through to each one. Named without a link for the
reason given above: close_members_cancelling does not exist in a build
with self-heal off, while this method does.
§Safety
The caller must ensure the pool is repaired, by submitting any work item
to it or by knowing something else keeps it live. See
ThreadpoolWait::try_cancel_pending_no_heal_tracking, whose obligation
this is.