We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95176b5 commit b072a03Copy full SHA for b072a03
SqliteCache/SqliteCache.cs
@@ -71,8 +71,13 @@ public void Dispose()
71
// EventWaitHandle.Set(SafeWaitHandle) method, which is just a wrapper around Kernel32's
72
// SetEvent() -- all of which is to say, we can't use a ManualResetEventSlim here.
73
using var resetEvent = new ManualResetEvent(false);
74
- _cleanupTimer.Dispose(resetEvent);
75
- resetEvent.WaitOne();
+ // If the timer has already been disposed, it'll return false immediately without setting the
+ // event. Since we don't really protect against our own .Dispose() method being called twice
76
+ // (maybe in a race), we should handle this eventuality.
77
+ if (_cleanupTimer.Dispose(resetEvent))
78
+ {
79
+ resetEvent.WaitOne();
80
+ }
81
}
82
Commands.Dispose();
83
0 commit comments