https://kotlinlang.org logo
#coroutines
Title
# coroutines
c

christophsturm

01/20/2021, 2:24 PM
is there a way to get the number of items in a channel (like queue.size) ?
d

Dominaezzz

01/20/2021, 3:52 PM
Not really, some of the underlying data structures make that difficult I think. May I ask what you're trying to achieve?
c

christophsturm

01/20/2021, 4:37 PM
i use a channel as a replacement for a queue and i want to monitor the queue size as a performance metric
d

Dominaezzz

01/20/2021, 4:41 PM
Ah, you'll have to track that yourself with an atomic int.
5 Views