4 ms·
Does it support select? Almost half of concurrrent programming use cases in Go are select related.
by tapirl 8y ago
Does it support select? Almost half of concurrrent programming use cases in Go are select related.
- benaadams 8y agoYeah, at a guess you'd combine the multiple `WaitToReadAsync` with `await Task.WhenAny`; then use `TryRead` to run though the bunch of channels in a non-blocking way. Could even use the return `await Task.WhenAny` to tell you the specific one to check. Shouldn't be a very hard construct to make; to make it more select like.
- tapirl 8y agogood. It looks it is much like the reflect.Select (https://golang.org/pkg/reflect/#Select https://golang.org/pkg/reflect/#Select) in Go. It has the benefit that any number of tasks can be selected, but the efficiency is not good as hard-coded select blocks. But it looks C# Task.WhenAny has much less use case variants than Go select block.