properly close all threads
This commit is contained in:
parent
82dc16fb1b
commit
a3ddb00b69
@ -121,6 +121,12 @@ internal class FileWatcherThread : IDisposable {
|
||||
}
|
||||
|
||||
public void Close() {
|
||||
if (thread != null) {
|
||||
done = true;
|
||||
Signal();
|
||||
thread.Join();
|
||||
thread = null;
|
||||
}
|
||||
if (stream != null) {
|
||||
stream.Close();
|
||||
stream = null;
|
||||
@ -129,12 +135,6 @@ internal class FileWatcherThread : IDisposable {
|
||||
file.Close();
|
||||
file = null;
|
||||
}
|
||||
if (thread != null) {
|
||||
done = true;
|
||||
Signal();
|
||||
thread.Join();
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
@ -249,6 +249,9 @@ public class JournalStream {
|
||||
watcher.EnableRaisingEvents = false;
|
||||
}
|
||||
watcher = null;
|
||||
foreach (var stream in streams) {
|
||||
stream.Value.Close();
|
||||
}
|
||||
streams.Clear();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user