Skip to content

Will select block if chan_can_recv first true then false? #26

@imnisen

Description

@imnisen

chan/src/chan.c

Line 407 in b4120ab

if (chan_can_recv(chan))

chan/src/chan.c

Line 444 in b4120ab

if (select.recv && chan_recv(select.chan, recv_out) != 0)

In the implementation of chan_select, it first checks every channel to see if it can recv/send. After that it randomly select one and do the recv/send.
What about if a channel can recv/send while checking but cannnot when really do it.
It seems the chan_select will block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions