2 ms·
> almost all of those async methods are built upon Task/Task<T> (which, IMO, is a flawed foundation) I like them, very flexible. It’s easy to implement these t
by Const-me 7y ago
> almost all of those async methods are built upon Task/Task<T> (which, IMO, is a flawed foundation)
I like them, very flexible. It’s easy to implement these tasks on top of pretty much anything.
Here’s how I have implemented back pressure when I needed something similar: https://github.com/Const-me/pCloud/blob/master/pCloudCore/Utils/TaskQueue.cs https://github.com/Const-me/pCloud/blob/master/pCloudCore/Ut... That class is very generic, knows nothing about the nature of the tasks, yet it’s able to do the right thing. Specifically, it limits count of pending tasks to a small number (8 by default), when exceeded the `post` method will start to “block” in the async way, that’s why it returns `Task<Task<TResult>>` instead of just `Task<TResult>`.