Is the task of the parallel library to block operations?

How does the .NET Task parallel library work with blocking tasks? In the C ++ Concrt library, you have a method Context::Oversubscribe

, but I haven't found one in the .NET library? Is the parameter the LongRunningTask

appropriate way to handle blocking tasks?

.ie: in C ++ you would do:

auto my_task_func = []
{
     //Do work...
     Context::Oversubscribe(true);
     // Short or long blocking op.
     Context::Oversubscribe(false);
     //Do more work.

}

      

+3


source to share


1 answer


TPL uses a hill climb algorithm to find the optimal number of threads without cooperating with the tasks themselves. It just keeps on injecting threads until the completion rate of the task improves.



+3


source







All Articles