How to check a RemoteChannel is open?

I wasn’t able to find anything about this in the documentation either.

However, I ended up with the following pattern.

addprocs(3)

println(nprocs())

arr = [i for i=1:4]

function producer(c::Channel)
    for item in arr
        put!(c, item)
    end
end

jobs = RemoteChannel(()->Channel(producer));
results = RemoteChannel(()->Channel(32));

@everywhere function do_work(jobs, results)
    while true
        x = try take!(jobs) end

        if x == nothing
            break
        end

        put!(results, (x, myid()))
    end
end

for p in workers() # start tasks on the workers to process requests in parallel
    remote_do(do_work, p, jobs, results)
end

results_taken = 0
while results_taken < length(arr)
    r = take!(results)

    results_taken += 1

    println(r)
end

close(results)