# Behavior of isready on unbuffered Channel

**URL:** https://discourse.julialang.org/t/behavior-of-isready-on-unbuffered-channel/86438
**Category:** General Usage
**Tags:** question, multithreading
**Created:** [August 27, 2022, 5:32pm UTC](https://discourse.julialang.org/t/behavior-of-isready-on-unbuffered-channel/86438 "2022-08-27T17:32:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![MiguelAlonso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miguelalonso/32/32151_2.png) [@MiguelAlonso](https://discourse.julialang.org/u/MiguelAlonso)
#### Post date: [August 27, 2022, 5:32pm UTC](https://discourse.julialang.org/t/behavior-of-isready-on-unbuffered-channel/86438/1 "2022-08-27T17:32:52Z")

</div>

Hello,

The [documentation](https://docs.julialang.org/en/v1/base/parallel/#Base.isready-Tuple%7BChannel%7D) for `Base.isready` says that the function returns `true` if there are tasks waiting on a `put!`.

However, on Julia 1.8 I tried this:

```julia
function unbuffered_channel_test()

    channel = Channel{Int64}()

    @async begin
        for _ in 1:2
            println("Waiting on Channel")
            v = take!(channel);
            println("Got $v")
        end
        println("Done")
    end

    sleep(1)
    @show isready(channel)
    put!(channel, 7)
    sleep(1)
    @show isready(channel)
    put!(channel, 11)

end

```

And I’m getting this:

```julia
julia> unbuffered_channel_test();
Waiting on Channel
isready(channel) = false
Got 7
Waiting on Channel      
isready(channel) = false
Got 11
Done

```

Shouldn’t `isready` return `true` while the consumer task is blocked on the `take!`? Am I misunderstanding something?

Thanks!

---

<div class="post-metadata">

### Author: ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)
#### Post date: [August 27, 2022, 6:21pm UTC](https://discourse.julialang.org/t/behavior-of-isready-on-unbuffered-channel/86438/2 "2022-08-27T18:21:46Z")

</div>

I think you are reading the documentation wrong. I take " Determine whether a `Channel` has a value stored to it.`, an `isready`in general, means that the channel is ready to be read, not that it is ready to be written to. Specifically, "For unbuffered channels returns`true` if there are tasks waiting on a [`put!`]" sounds like a `take!` won’t block.

---

<div class="post-metadata">

### Author: ![MiguelAlonso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miguelalonso/32/32151_2.png) [@MiguelAlonso](https://discourse.julialang.org/u/MiguelAlonso)
#### Post date: [August 27, 2022, 6:46pm UTC](https://discourse.julialang.org/t/behavior-of-isready-on-unbuffered-channel/86438/3 "2022-08-27T18:46:54Z")

</div>

You’re absolutely right. I interpreted the phrase “there are tasks waiting on a `put!`” as “`Task`s are blocked waiting _for another_ to `put!` something in the `Channel`”. But it actually means “the putting `Task` is blocked waiting for another to `take!` from the `Channel`”. Which, like you said, is consistent with the behavior for a buffered `Channel`.
