30 ms·
Being not super familiar with Go, I think C#'s async/await is similar, isn't it? If you want more complex operations, you might want to look into System.IO.Pipe
by foepys 4y ago
Being not super familiar with Go, I think C#'s async/await is similar, isn't it? If you want more complex operations, you might want to look into System.IO.Pipelines.
- Rapzid 4y agoNah, totally different than channels. And Goroutines are proper managed threads with their own stacks. As an aside pipelines are terriblely unergonomic. The public APIs are not fully developed and something simple, like IDK creating an actual processing pipeline, is funky as all hell. Creating a pipe wrapper feels dirty. The buffer management is cool though and sequence seems like it should have just been made a first class slice type..
- metaltyphoon 4y agoC# has channels as a library and not a language construct, it lives in System.Threading.Channels namespace.
- Rapzid 4y agoThey do have channels but they don't supply a select equivalent.
- DaiPlusPlus 4y ago.NET’s Pipeline type is not intended for processing-pipelines (surely that would be Windows Workflow Foundation and SSIS?) - it’s meant to be an alternative (and performance-optimised) API for reading and writing to IO streams without faffing around with the differences between MemoryStream, FileStream, and NetworkStream - like if you’re implementing your own network protocol server and client. See https://learn.microsoft.com/en-us/dotnet/standard/io/pipelines https://learn.microsoft.com/en-us/dotnet/standard/io/pipelin... The main problem it seems to solve is processing a text or byte range from a stream (be it an endless SSE/WebSocket stream of messages, or just from a huge (multigigabyte+) file on disk - in a non-blocking/async manner.