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

Go's select statement: can a co-routine wait for multiple events at the same time, and process them in order they arrive #14

Open
poetaman opened this issue Jan 11, 2022 · 1 comment

Comments

@poetaman
Copy link

poetaman commented Jan 11, 2022

Go's select statement: can a co-routine wait for multiple events (read from channels) at the same time, and process them in order they arrive? Thus achieving highest performance...

Here's an example: https://stackoverflow.com/a/20607625/15239054

@shiyanhui
Copy link
Owner

The select statement in Go actually doesn't process them in order they arrive but in a random order, see https://github.com/golang/go/blob/master/src/runtime/select.go#L168.

Libcsp doesn't provide the select statement, but you can simulate it. See https://github.com/shiyanhui/libcsp/blob/master/examples/select.c.

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

2 participants