Skip to content

Commit 6850f8f

Browse files
authored
Merge pull request #31 from dotnet-campus/t/lindexi/nullable-asyncqueue
加上可空
2 parents 80f6912 + ba46a36 commit 6850f8f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

AsyncWorkerCollection/AsyncAutoResetEvent.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#nullable enable
2+
using System;
23
using System.Collections.Generic;
34
using System.Threading.Tasks;
45

@@ -24,6 +25,9 @@ public AsyncAutoResetEvent(bool initialState)
2425
_isSignaled = initialState;
2526
}
2627

28+
/// <summary>
29+
/// 析构方法
30+
/// </summary>
2731
~AsyncAutoResetEvent()
2832
{
2933
Dispose();
@@ -68,7 +72,7 @@ public Task<bool> WaitOneAsync()
6872
/// </summary>
6973
public void Set()
7074
{
71-
TaskCompletionSource<bool> releaseSource = null;
75+
TaskCompletionSource<bool>? releaseSource = null;
7276
bool result;
7377
lock (_locker)
7478
{

AsyncWorkerCollection/AsyncQueue.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#nullable enable
2+
using System;
23
using System.Collections.Concurrent;
34
using System.Collections.Generic;
45
using System.Threading;
@@ -96,7 +97,7 @@ public async Task<T> DequeueAsync(CancellationToken cancellationToken = default)
9697
}
9798
}
9899

99-
return default;
100+
return default!;
100101
}
101102

102103
/// <summary>
@@ -175,7 +176,7 @@ private void ThrowIfDisposing()
175176
}
176177
}
177178

178-
private event EventHandler CurrentFinished;
179+
private event EventHandler? CurrentFinished;
179180

180181
private bool _isDisposing;
181182
private bool _isDisposed;

0 commit comments

Comments
 (0)