When should a task be considered “long running”?

后端 未结 4 1273
野趣味
野趣味 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:18

    As you point out, TaskCreationOptions.LongRunning's purpose is

    to allow the ThreadPool to continue to process work items even though one task is running for an extended period of time

    As for when to use it:

    It's not a specific length per se...You'd typically only use LongRunning if you found through performance testing that not using it was causing long delays in the processing of other work.

    Source

提交回复
热议问题