diff --git a/src/main.d b/src/main.d index 2dc1aa93..46c47b8f 100644 --- a/src/main.d +++ b/src/main.d @@ -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)); diff --git a/src/monitor.d b/src/monitor.d index 1ede4d0f..86e6912d 100644 --- a/src/monitor.d +++ b/src/monitor.d @@ -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; }