Golang Channel Selection

Just experiment with go recently. I was wondering what would happen if you have a select statement waiting to communicate on several channels, and if the message arrives at the same time on two or more channels. How to choose which channel will receive if all messages arrive at the same time?

Thanks!

+6
source share
1 answer

From spec :

If several cases can continue, a uniform pseudo-random choice is created to decide which one link will be made.

Thus, the choice is not deterministic.

+17
source

Source: https://habr.com/ru/post/957699/


All Articles