properly close all threads

This commit is contained in:
Florian Stinglmayr 2025-08-06 14:39:52 +02:00
parent 82dc16fb1b
commit a3ddb00b69

View File

@ -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();
}