channel_len
result = channel_len(ch)
Input: ch · Output: result
What it is
How many messages are queued right now on channel ch, without consuming any of them.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = channel_len(ch) | ch —not documented yet | result — | Returns an integer — a diagnostic/backpressure-aware-producer helper, not needed for ordinary send/recv. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
ch = channel()
print(channel_try_recv(ch)) # none -- nothing queued yet
channel_send(ch, 1)
channel_send(ch, 2)
print(channel_len(ch)) # 2
print(channel_recv(ch)) # 1 (FIFO)
output
none 2 1
from concurrency
How it works
channel_len(ch) — how many messages are queued right now (diagnostic/backpressure-aware-producer use, not needed for ordinary send/recv).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.