34 #include <boost/thread/locks.hpp> 35 #include <boost/thread/mutex.hpp> 36 #include <boost/optional.hpp> 37 #include <system_error> 72 std::unique_ptr<std::FILE, close_file> m_handle;
91 std::FILE*
handle() const noexcept {
return m_handle.get(); }
130 std::string get_special_folder_path(
int nfolder,
bool iscreate);
167 bool r = TRUE == ::SetConsoleCtrlHandler(&win_handler, TRUE);
174 static struct sigaction sa;
175 memset(&sa, 0,
sizeof(
struct sigaction));
176 sa.sa_handler = posix_handler;
179 sigaction(SIGINT, &sa, NULL);
180 signal(SIGTERM, posix_handler);
181 signal(SIGPIPE, SIG_IGN);
190 static BOOL WINAPI win_handler(DWORD type)
192 if (CTRL_C_EVENT == type || CTRL_BREAK_EVENT == type)
198 MGINFO_RED(
"Got control signal " << type <<
". Exiting without saving...");
205 static void posix_handler(
int type)
212 static void handle_signal(
int type)
214 static boost::mutex m_mutex;
215 boost::unique_lock<boost::mutex> lock(m_mutex);
220 static std::function<void(int)> m_handler;
231 int vercmp(
const char *v0,
const char *v1);
236 boost::optional<bool>
is_hdd(
const char *path);
unsigned __int64 uint64_t