# How to check a RemoteChannel is open?

**URL:** <https://discourse.julialang.org/t/how-to-check-a-remotechannel-is-open/3829>\
**Category:** General Usage\
**Created:** [May 20, 2017, 9:36pm UTC](https://discourse.julialang.org/t/how-to-check-a-remotechannel-is-open/3829 "2017-05-20T21:36:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gasagna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gasagna/32/1275_2.png) [@gasagna](https://discourse.julialang.org/u/gasagna)\
**Post date:** [May 20, 2017, 9:36pm UTC](https://discourse.julialang.org/t/how-to-check-a-remotechannel-is-open/3829/1 "2017-05-20T21:36:18Z")

</div>

You can check whether a `RemoteChannel` object `isready`, but `isopen(::RemoteChannel)` seems not to be defined.

Basically, I am using a `RemoteChannel` to transfer jobs to remote workers but these throw an error when the underlying channel gets closed.

Thanks!

---

<div class="post-metadata">

**Author:** ![CiaranOMara](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ciaranomara/32/2589_2.png) [@CiaranOMara](https://discourse.julialang.org/u/CiaranOMara)\
**Post date:** [November 21, 2017, 7:54am UTC](https://discourse.julialang.org/t/how-to-check-a-remotechannel-is-open/3829/2 "2017-11-21T07:54:51Z")

</div>

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

However, I ended up with the following pattern.

```julia
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)

```
