Skip to main content

spawn_native_announcement_loop

Function spawn_native_announcement_loop 

Source
pub(crate) fn spawn_native_announcement_loop<F, Fut>(
    require_initial: bool,
    cancellation: CancellationToken,
    loop_body: F,
) -> Option<Receiver<Result<(), String>>>
where F: FnOnce(Option<Arc<Mutex<Option<Sender<Result<(), String>>>>>>) -> Fut + Send + 'static, Fut: Future<Output = ()> + Send + 'static,
Expand description

Spawn the native-announcement refresh loop on its own current-thread Tokio runtime and return a channel for the first announcement result.

loop_body receives an optional one-shot sender for the first result; it should send at most once. The runtime is kept alive until loop_body completes or the bound service cancels it. Cancellation interrupts both the first-result wait and subsequent refresh; it never satisfies readiness.