3 ms·
My motivating use case was a web browser: at any given point it may be browsing a number of resources, and for some of those it will be in the middle of making
by 082349872349872 3y ago
My motivating use case was a web browser: at any given point it may be browsing a number of resources, and for some of those it will be in the middle of making requests to a protocol handler (SEND) while for others it will be in the middle of reading responses from them (RECEIVE).
But in general any time you might want to block until the first ready channel, it doesn't work if eg a channel becomes SEND'able but your code is currently blocked on the group RECEIVE. (this situation can be kludged with nonblocking calls, but a blocking call is friendlier to whatever else may be running in the system)
- Rochus 3y agoThanks. But wouldn't each request rather run in a separate go routine? > in general any time you might want to block until the first ready channel, it doesn't work if eg a channel becomes SEND'able but your code is currently blocked on the group RECEIVE Sure, but I think this can easily be avoided by using different go routines, i.e. not routing everything through only one. So I would be interested in examples where this is not possible or not feasible for some reason.