mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-15 12:15:36 +02:00
Fix shutdown process
This commit is contained in:
parent
991fe88512
commit
f2923d1cb9
|
@ -1139,7 +1139,9 @@ void performStandardExitProcess(string scopeCaller = null) {
|
||||||
selectiveSync = null;
|
selectiveSync = null;
|
||||||
syncEngineInstance = null;
|
syncEngineInstance = null;
|
||||||
} else {
|
} else {
|
||||||
addLogEntry("Application exit", ["debug"]);
|
addLogEntry("Waiting for all servicecs to shutdown");
|
||||||
|
thread_joinAll();
|
||||||
|
addLogEntry("Application exit");
|
||||||
addLogEntry("#######################################################################################################################################", ["logFileOnly"]);
|
addLogEntry("#######################################################################################################################################", ["logFileOnly"]);
|
||||||
// Sleep to allow any final logging output to be printed - this is needed as we are using buffered logging output
|
// 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));
|
Thread.sleep(dur!("msecs")(500));
|
||||||
|
|
|
@ -102,7 +102,7 @@ class MonitorBackgroundWorker {
|
||||||
FD_SET((cast()p).readEnd.fileno, &fds);
|
FD_SET((cast()p).readEnd.fileno, &fds);
|
||||||
|
|
||||||
res = select(FD_SETSIZE, &fds, null, null, null);
|
res = select(FD_SETSIZE, &fds, null, null, null);
|
||||||
|
|
||||||
if(res == -1) {
|
if(res == -1) {
|
||||||
if(errno() == EINTR) {
|
if(errno() == EINTR) {
|
||||||
// Received an interrupt signal but no events are available
|
// Received an interrupt signal but no events are available
|
||||||
|
@ -121,7 +121,6 @@ class MonitorBackgroundWorker {
|
||||||
isAlive = receiveOnly!bool();
|
isAlive = receiveOnly!bool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callerTid.send(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shared void interrupt() {
|
shared void interrupt() {
|
||||||
|
@ -234,16 +233,9 @@ final class Monitor {
|
||||||
initialised = false;
|
initialised = false;
|
||||||
// Release all resources
|
// Release all resources
|
||||||
removeAll();
|
removeAll();
|
||||||
worker.interrupt();
|
|
||||||
// Notify the worker that the monitor has been shutdown
|
// Notify the worker that the monitor has been shutdown
|
||||||
receiveTimeout(dur!"seconds"(-1), (int _) {});
|
worker.interrupt();
|
||||||
send(false);
|
send(false);
|
||||||
// Wait for the worker to terminate
|
|
||||||
int result = 1;
|
|
||||||
while(result == 1) {
|
|
||||||
result = receiveOnly!int();
|
|
||||||
}
|
|
||||||
worker.shutdown();
|
|
||||||
wdToDirName = null;
|
wdToDirName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue