tokio-rs / tokio

A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
https://tokio.rs
MIT License
26.59k stars 2.45k forks source link

sync, coop: apply cooperative scheduling to sync::broadcast::Receiver #6870

Closed tglane closed 1 week ago

tglane commented 1 week ago

Motivation

Similar to #6846 the function sync::broadcast::Receiver::recv utilize cooperative scheduling to prevent that a task could block the runtime.

Solution

I added the usage of runtime::coop::Coop that was added in #6846 to the function so that takes part in the coop budget.

Closes #6855.