Sunday, July 17, 2016

AsyncMemoryStream

Well, that was fun. I haven't stayed up late hacking in a while.

The plan for the prototype is to be client-only, no persistence. But of course I can't help thinking about the future. I wanted to make a fairly "real" feeling application transport layer that operated on the Stream level. For now, the client's input and output streams will just be hooked up to a server module that is running in-process.

To make that work, though, I needed a thread-aware Stream that acted like FIFO byte queue, and I don't think there is anything like that out of the box in C#.

So here I am working on one. Most of the synchronous operations are in place, but I still have some unit test failures around cases where the internal ring buffer needs to grow. I'd really like to get the async Read/Write methods working asynchronously too (via deferring the work to the ThreadPool). I think that be a good "broom" for async bugs that might not otherwise show up until much later.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.