smol-rs/async-channel

Sending can yield the thread

NathanRoyer opened this issue · 1 comments

When we call try_send on a sender, here's what I think is happening:

  • ConcurrentQueue::push is called here
  • If the queue is unbounded, Unbounded::push is called here
  • If the queue reached its current capacity, busy_wait is called here
  • Which either spins or yields the thread, as defined here

I find it weird that we end up yielding the thread in async code.
If this is expected, I think it should be documented.

@notgull have you seen this and would you like me to work on a solution?