What is the purpose of TaskCreationOptions with a TaskCompletionSource?

后端 未结 1 1781
-上瘾入骨i
-上瘾入骨i 2021-01-11 13:07

There\'s something unclear to me about the inner workings of TaskCompletionSource<>.

When creating a simple Task<> using the

相关标签:
1条回答
  • 2021-01-11 14:13

    The answer is that a TaskCreationOption is useful for its AttachToParent option only, as TaskCompletionSource can be the child of any other task. Options related to thread management or execution ordering aren't relevant in the context of a TaskCompletionSource. The following code actually throws an exception:

    new TaskCompletionSource<WebResponse>(TaskCreationOptions.LongRunning);
    
    0 讨论(0)
提交回复
热议问题