When should a task be considered “long running”?

后端 未结 4 1270
野趣味
野趣味 2021-02-09 08:25

When working with tasks, a rule of thumb appears to be that the thread pool - typically used by e.g. invoking Task.Run(), or Parallel.Invoke() - shoul

4条回答
  •  生来不讨喜
    2021-02-09 09:15

    You should not use TaskCreationOptions.LongRunning in your case. I would use Parallel.For.

    The LongRunning option is not to be used if you're going to create a lot of tasks, just like in your case. It is to be used for creating couple of tasks that will be running for a Long Time.

    By the way, i never used this option in any similar scenario.

提交回复
热议问题