提交 d60e18f5 编写于 作者: S Sam Harwell

Avoid scheduling an unnecessary dispose task for EmptyAsyncToken

Fixes #22272
上级 bfb294e9
......@@ -18,6 +18,8 @@ private EmptyAsyncToken()
public void Dispose()
{
// Empty by design requirement: operations which use IAsyncToken are free to optimize code sequences by
// eliding calls to EmptyAsyncToken.Dispose() with the understanding that it doesn't do anything.
}
}
}
......@@ -21,7 +21,7 @@ public static Task CompletesAsyncOperation(this Task task, IAsyncToken asyncToke
public static Task CompletesTrackingOperation(this Task task, IDisposable token)
{
if (token == null)
if (token == null || token == EmptyAsyncToken.Instance)
{
return task;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册