Skip to content

Commit 3693c64

Browse files
committed
修改命名
1 parent 8cb9f97 commit 3693c64

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

AsyncWorkerCollection/AsyncAutoResetEvent.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ private static readonly Task<bool> CompletedSourceTask
2929
= Task.FromResult(true);
3030

3131
/// <summary>
32-
/// 异步等待一个信号,需要await
32+
/// 异步等待一个信号,需要 await 等待
33+
/// <para></para>
34+
/// 可以通过返回值是 true 或 false 判断当前是收到信号还是此类被释放
3335
/// </summary>
34-
/// <returns>如果是正常解锁,那么返回 true 值。如果是对象调用 <see cref="Dispose"/> 释放,那么返回 false 值</returns>
36+
/// <returns>
37+
/// 如果是正常解锁,那么返回 true 值。如果是对象调用 <see cref="Dispose"/> 释放,那么返回 false 值
38+
/// </returns>
3539
public Task<bool> WaitOneAsync()
3640
{
3741
lock (_locker)
3842
{
39-
if (_isDisposing)
43+
if (_isDisposed)
4044
{
4145
throw new ObjectDisposedException(nameof(AsyncAutoResetEvent));
4246
}
@@ -78,7 +82,7 @@ public void Set()
7882
}
7983

8084
// 如果这个类被释放了,那么返回 false 值
81-
result = !_isDisposing;
85+
result = !_isDisposed;
8286
}
8387

8488
releaseSource?.SetResult(result);
@@ -91,7 +95,7 @@ public void Dispose()
9195
{
9296
lock (_locker)
9397
{
94-
_isDisposing = true;
98+
_isDisposed = true;
9599
}
96100

97101
GC.SuppressFinalize(this);
@@ -111,7 +115,7 @@ public void Dispose()
111115
}
112116
}
113117

114-
private bool _isDisposing;
118+
private bool _isDisposed;
115119

116120
private readonly object _locker = new object();
117121

0 commit comments

Comments
 (0)