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

runtime: selectgo need not lock all the channels involved in the select #41948

Open
dreamerjackson opened this issue Oct 13, 2020 · 2 comments
Open

Comments

@dreamerjackson
Copy link

@dreamerjackson dreamerjackson commented Oct 13, 2020

i read the select function:

func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) {
   ...
	// lock all the channels involved in the select
	sellock(scases, lockorder)

}

why we should lock all the channels?
i think lock one by one when loop may be better , because it will quickly

@randall77
Copy link
Contributor

@randall77 randall77 commented Oct 13, 2020

Dmitry tried this a while ago: https://go-review.googlesource.com/c/go/+/7570
TL; DR it is tricky to get right. We never convinced ourselves it was correct.

@dreamerjackson
Copy link
Author

@dreamerjackson dreamerjackson commented Oct 14, 2020

Dmitry tried this a while ago: https://go-review.googlesource.com/c/go/+/7570
TL; DR it is tricky to get right. We never convinced ourselves it was correct.

most case it may will work ok,but select is one of the most important role in go, when channel in select increase and Concurrent oparate the channels, the performance will down.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.