Skip to content

Commit 9769a06

Browse files
committed
修复内存泄露
1 parent 7ce15a8 commit 9769a06

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

AsyncWorkerCollection/AsyncTaskQueue_/AsyncTaskQueue.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ private void Dispose(bool disposing)
187187
if (_isDisposed) return;
188188
if (disposing)
189189
{
190-
//_autoResetEvent.Dispose();
191190
}
192191

192+
// 先调用 Clear 方法,然后调用 _autoResetEvent.Dispose 此时的任务如果还没执行的,就不会执行
193193
_queue.Clear();
194+
_autoResetEvent.Dispose();
194195
_isDisposed = true;
195196
}
196197

0 commit comments

Comments
 (0)