RemoteChannel allows more inputs than I defined

yes!

Consider the following MWE:

The following blocks (freezes) the user process at step 6 of the for loop:

ch = Channel(5)
for i in 1:6
    put!(ch, i)
end
values = [take!(ch) for _ in 1:6]

the following does not block the user process but the @async task:

ch = Channel(5)
@async for i in 1:6
    put!(ch, i)
end
values = [take!(ch) for _ in 1:6]

When you start to take! out the values, the task continues and delivers the 6th value asynchronously.

2 Likes