Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
imnisen opened this issue Oct 12, 2019 · 0 comments
Open

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

imnisen opened this issue Oct 12, 2019 · 0 comments

Comments

@imnisen
Copy link

imnisen commented Oct 12, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant