is there a way to count the total elements remaini...
# coroutines
c
is there a way to count the total elements remaining in an channel without consuming them? can it be even done?
z
There's no API for that. And since channel operations are generally lock-free and atomic, any counting operation would not be linearizable and could be wrong by the time it's returned. That said, if you're in a debugger, you can pause the jvm and inspect the internal linked list to count it manually.
👍 1
1