Issue "Shutdown complete" message after destructors complete.

This commit is contained in:
Robin Davies
2024-09-27 11:02:51 -04:00
parent b9d27c2c1a
commit 0b7078b592
+7 -14
View File
@@ -53,8 +53,6 @@ using namespace pipedal;
#define AARCH64 #define AARCH64
#endif #endif
class application_category : public boost::system::error_category class application_category : public boost::system::error_category
{ {
public: public:
@@ -81,7 +79,6 @@ static bool isJackServiceRunning()
return std::filesystem::exists(path); return std::filesystem::exists(path);
} }
static void AsanCheck() static void AsanCheck()
{ {
char *t = new char[5]; char *t = new char[5];
@@ -214,6 +211,7 @@ int main(int argc, char *argv[])
} }
try try
{
{ {
{ {
auto locale = Locale::GetInstance(); auto locale = Locale::GetInstance();
@@ -244,19 +242,16 @@ int main(int argc, char *argv[])
throw std::logic_error("pthread_sigmask failed."); throw std::logic_error("pthread_sigmask failed.");
} }
PiPedalModel model; PiPedalModel model;
model.SetNetworkChangedListener( model.SetNetworkChangedListener(
[&server]() mutable { [&server]() mutable
{
if (server) if (server)
{ {
server->DisplayIpAddresses(); server->DisplayIpAddresses();
} }
} });
);
model.SetRestartListener( model.SetRestartListener(
[]() []()
@@ -279,7 +274,6 @@ int main(int argc, char *argv[])
model.WaitForAudioDeviceToComeOnline(); model.WaitForAudioDeviceToComeOnline();
#if JACK_HOST #if JACK_HOST
if (systemd) if (systemd)
{ {
@@ -324,10 +318,8 @@ int main(int argc, char *argv[])
{ {
server->RunInBackground(-1); server->RunInBackground(-1);
model.StartHotspotMonitoring(); model.StartHotspotMonitoring();
{ {
sigwait(&sigSet, &sig); sigwait(&sigSet, &sig);
@@ -345,10 +337,11 @@ int main(int argc, char *argv[])
Lv2Log::info("Stopping web server."); Lv2Log::info("Stopping web server.");
server->ShutDown(5000); server->ShutDown(5000);
server->Join(); server->Join();
}
Lv2Log::info("Shutdown complete."); Lv2Log::info("Shutdown complete.");
if (g_restart) return EXIT_FAILURE; // indicate to systemd that we want a restart. if (g_restart)
return EXIT_FAILURE; // indicate to systemd that we want a restart.
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {