Fix shutdown process

This commit is contained in:
Jcomp 2024-02-13 02:07:12 +00:00
parent 991fe88512
commit f2923d1cb9
2 changed files with 5 additions and 11 deletions

View file

@ -1139,7 +1139,9 @@ void performStandardExitProcess(string scopeCaller = null) {
selectiveSync = null;
syncEngineInstance = null;
} else {
addLogEntry("Application exit", ["debug"]);
addLogEntry("Waiting for all servicecs to shutdown");
thread_joinAll();
addLogEntry("Application exit");
addLogEntry("#######################################################################################################################################", ["logFileOnly"]);
// Sleep to allow any final logging output to be printed - this is needed as we are using buffered logging output
Thread.sleep(dur!("msecs")(500));

View file

@ -102,7 +102,7 @@ class MonitorBackgroundWorker {
FD_SET((cast()p).readEnd.fileno, &fds);
res = select(FD_SETSIZE, &fds, null, null, null);
if(res == -1) {
if(errno() == EINTR) {
// Received an interrupt signal but no events are available
@ -121,7 +121,6 @@ class MonitorBackgroundWorker {
isAlive = receiveOnly!bool();
}
}
callerTid.send(0);
}
shared void interrupt() {
@ -234,16 +233,9 @@ final class Monitor {
initialised = false;
// Release all resources
removeAll();
worker.interrupt();
// Notify the worker that the monitor has been shutdown
receiveTimeout(dur!"seconds"(-1), (int _) {});
worker.interrupt();
send(false);
// Wait for the worker to terminate
int result = 1;
while(result == 1) {
result = receiveOnly!int();
}
worker.shutdown();
wdToDirName = null;
}