You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Microsoft.VisualStudio.Threading/AsyncLazy`1.cs
+10-11Lines changed: 10 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -41,14 +41,14 @@ public class AsyncLazy<T>
41
41
privateAsyncLocal<object>?recursiveFactoryCheck;
42
42
43
43
/// <summary>
44
-
/// The function to invoke to produce the task.
44
+
/// An optional means to avoid deadlocks when synchronous APIs are called that must invoke async methods in user code.
45
45
/// </summary>
46
-
privateFunc<Task<T>>?valueFactory;
46
+
privatereadonlyJoinableTaskFactory?jobFactory;
47
47
48
48
/// <summary>
49
-
/// The async pump to Join on calls to <see cref="GetValueAsync(CancellationToken)"/>.
49
+
/// The function to invoke to produce the task.
50
50
/// </summary>
51
-
privateJoinableTaskFactory?jobFactory;
51
+
privateFunc<Task<T>>?valueFactory;
52
52
53
53
/// <summary>
54
54
/// The result of the value factory.
@@ -64,7 +64,10 @@ public class AsyncLazy<T>
64
64
/// Initializes a new instance of the <see cref="AsyncLazy{T}"/> class.
65
65
/// </summary>
66
66
/// <param name="valueFactory">The async function that produces the value. To be invoked at most once.</param>
67
-
/// <param name="joinableTaskFactory">The factory to use when invoking the value factory in <see cref="GetValueAsync(CancellationToken)"/> to avoid deadlocks when the main thread is required by the value factory.</param>
67
+
/// <param name="joinableTaskFactory">
68
+
/// The <see cref="JoinableTaskFactory" /> to use for avoiding deadlocks when the <paramref name="valueFactory"/>
69
+
/// or the constructed value's <see cref="System.IAsyncDisposable.DisposeAsync"/> method may require the main thread in the process.
0 commit comments