zesterer / flume

A safe and fast multi-producer, multi-consumer channel.
https://crates.io/crates/flume
Apache License 2.0
2.47k stars 85 forks source link

Expose sender_count / receiver_count to the user #110

Closed coolreader18 closed 2 years ago

coolreader18 commented 2 years ago

This'd be useful to get a simple head count of a task "pool": if send() times out, you could check the receiver_count() to see if it's worth spawning another worker thread. A concern is that maybe it'd be exposing implementation details, but I feel like the senders/receivers are always gonna be reference counted to some extent so it's not hard to provide.