Teaspeak-Server/server/src/ShutdownHelper.h

24 lines
798 B
C
Raw Permalink Normal View History

#pragma once
#include "Configuration.h"
namespace ts {
2020-01-24 02:57:58 +01:00
namespace server {
extern void shutdownInstance(const std::string& reason = ts::config::messages::applicationStopped);
2021-04-14 23:12:51 +02:00
extern bool isShuttingDown();
2020-01-24 02:57:58 +01:00
struct ShutdownData {
std::string reason;
std::chrono::system_clock::time_point time_point;
bool active;
2020-01-24 02:57:58 +01:00
std::thread shutdown_thread{};
std::mutex shutdownMutex;
std::condition_variable shutdownNotify;
};
2020-01-24 02:57:58 +01:00
extern bool scheduleShutdown(const std::chrono::system_clock::time_point&, const std::string& = ts::config::messages::applicationStopped);
extern std::shared_ptr<ShutdownData> scheduledShutdown();
extern void cancelShutdown(bool notify = true);
}
}