diff --git a/src/util/platform.cpp b/src/util/platform.cpp index d4d399250..061c78e28 100644 --- a/src/util/platform.cpp +++ b/src/util/platform.cpp @@ -57,7 +57,14 @@ void platform::sleep(size_t millis) { // Reset the timer resolution back to the system default timeEndPeriod(periodMin); } -#else + +int platform::get_process_id() { + return GetCurrentProcessId(); +} + +#else // _WIN32 + +#include void platform::configure_encoding() { } @@ -74,7 +81,11 @@ std::string platform::detect_locale() { void platform::sleep(size_t millis) { std::this_thread::sleep_for(std::chrono::milliseconds(millis)); } -#endif + +int platform::get_process_id() { + return getpid(); +} +#endif // _WIN32 void platform::open_folder(const std::filesystem::path& folder) { if (!std::filesystem::is_directory(folder)) { diff --git a/src/util/platform.hpp b/src/util/platform.hpp index 1283bcfea..6793411ed 100644 --- a/src/util/platform.hpp +++ b/src/util/platform.hpp @@ -12,4 +12,5 @@ namespace platform { void open_folder(const std::filesystem::path& folder); /// Makes the current thread sleep for the specified amount of milliseconds. void sleep(size_t millis); + int get_process_id(); }