Skip to main content

StopHandle

Struct StopHandle 

Source
pub struct StopHandle { /* private fields */ }
Expand description

Handle to stop a running scheduler.

Implementations§

Source§

impl StopHandle

Source

pub async fn stop(&self)

Stop the scheduler and join the capture thread. &self + interior-mutable thread so a session host holding a shared Arc<StopHandle> can stop it without sole ownership. Idempotent — a second call (or drop after) sees thread already taken and no-ops.

ASYNC on purpose — the wait must YIELD to the runtime, never block it. The timing thread’s final flush block_ons CadenceReporter::shutdown_flush, whose ack comes from the reporter’s OWNER — a tokio task on the caller’s runtime. A blocking wait here deadlocked a CURRENT-THREAD runtime three ways: this (the only runtime) thread parked in recv(), the timing thread parked awaiting the owner’s ack, and the owner task unable to run on the parked runtime. Multi-thread runtimes escaped via block_in_place + spare workers, which is why only single-threaded harnesses hung. The yield-poll below lets same-runtime tasks progress on every flavor; this is a session-end one-shot, so the 2 ms poll cadence touches no hot path.

Source

pub fn cadence_reporter(&self) -> Option<&Arc<CadenceReporter>>

Reference to the cadence reporter, if any.

Remains valid and queryable after the scheduler is stopped.

Source

pub fn report_frame(&self, snapshot: &MetricSet)

Deliver a frame to reporters asynchronously.

The frame is enqueued on a channel and processed by the scheduler thread on its next tick. This never blocks the caller — safe to call from tokio worker threads.

Trait Implementations§

Source§

impl Drop for StopHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.