#pragma once #ifdef WIN32 #include extern char myWndClassName[]; #ifdef SIGTERM #undef SIGTERM #define SIGTERM (WM_USER + 15) #endif #ifdef SIGINT #undef SIGINT #define SIGINT (WM_USER + 2) #endif #ifndef SIGUSR1 #define SIGUSR1 (WM_USER + 10) #endif #ifndef SIGUSR2 #define SIGUSR2 (WM_USER + 12) #endif #elif POSIX #include #include #include #include #else #error "Undefine platform" #endif #include #include #include #include namespace System { #ifdef WIN32 typedef ::SOCKET native_socket_type; #elif POSIX typedef int native_socket_type; #else #error "Undefine platform" #endif #ifdef WIN32 typedef ::DWORD native_processid_type; #elif POSIX typedef ::pid_t native_processid_type; #else #error "Undefine platform" #endif inline native_processid_type getProcessId() { #ifdef WIN32 return ::GetCurrentProcessId(); #elif POSIX return ::getpid(); #else #error "Undefine platform" #endif } bool sendSignal(const native_processid_type pid, const int signal); inline bool isDoneThread(const std::thread::native_handle_type handle) { #ifdef WIN32 return WAIT_OBJECT_0 == ::WaitForSingleObject(handle, 0); #elif POSIX return 0 != ::pthread_kill(handle, 0); #else #error "Undefine platform" #endif } std::string getTempDir(); bool getFileSizeAndTimeGmt(const std::string &, size_t *, time_t *); };