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