add platform::get_process_id

This commit is contained in:
MihailRis 2024-12-12 16:37:06 +03:00
parent 8e6fb1dfb4
commit 913f942adb
2 changed files with 14 additions and 2 deletions

View File

@ -57,7 +57,14 @@ void platform::sleep(size_t millis) {
// Reset the timer resolution back to the system default // Reset the timer resolution back to the system default
timeEndPeriod(periodMin); timeEndPeriod(periodMin);
} }
#else
int platform::get_process_id() {
return GetCurrentProcessId();
}
#else // _WIN32
#include <unistd.h>
void platform::configure_encoding() { void platform::configure_encoding() {
} }
@ -74,7 +81,11 @@ std::string platform::detect_locale() {
void platform::sleep(size_t millis) { void platform::sleep(size_t millis) {
std::this_thread::sleep_for(std::chrono::milliseconds(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) { void platform::open_folder(const std::filesystem::path& folder) {
if (!std::filesystem::is_directory(folder)) { if (!std::filesystem::is_directory(folder)) {

View File

@ -12,4 +12,5 @@ namespace platform {
void open_folder(const std::filesystem::path& folder); void open_folder(const std::filesystem::path& folder);
/// Makes the current thread sleep for the specified amount of milliseconds. /// Makes the current thread sleep for the specified amount of milliseconds.
void sleep(size_t millis); void sleep(size_t millis);
int get_process_id();
} }