Add inlined current thread id on Linux and Android

This commit is contained in:
Wojtek Figat
2022-01-11 13:24:53 +01:00
parent 495b309736
commit dafa6bff2e
4 changed files with 10 additions and 13 deletions

View File

@@ -709,11 +709,6 @@ ProcessMemoryStats AndroidPlatform::GetProcessMemoryStats()
return result;
}
uint64 AndroidPlatform::GetCurrentThreadID()
{
return static_cast<uint64>(pthread_self());
}
void AndroidPlatform::SetThreadPriority(ThreadPriority priority)
{
// TODO: impl this

View File

@@ -5,6 +5,7 @@
#if PLATFORM_ANDROID
#include "Engine/Platform/Unix/UnixPlatform.h"
#include <pthread.h>
struct android_app;
@@ -83,7 +84,10 @@ public:
static int32 GetCacheLineSize();
static MemoryStats GetMemoryStats();
static ProcessMemoryStats GetProcessMemoryStats();
static uint64 GetCurrentThreadID();
static uint64 GetCurrentThreadID()
{
return static_cast<uint64>(pthread_self());
}
static void SetThreadPriority(ThreadPriority priority);
static void SetThreadAffinityMask(uint64 affinityMask);
static void Sleep(int32 milliseconds);

View File

@@ -215,7 +215,6 @@ static int X11_MessageBoxInit(MessageBoxData* data)
LINUX_DIALOG_PRINT("Couldn't load font %s", MessageBoxFont);
data->font_set = X11::XCreateFontSet(data->display, "fixed", &missing, &num_missing, NULL);
if (missing != nullptr) X11::XFreeStringList(missing);
//return 1;
}
return 0;
@@ -1792,11 +1791,6 @@ ProcessMemoryStats LinuxPlatform::GetProcessMemoryStats()
return result;
}
uint64 LinuxPlatform::GetCurrentThreadID()
{
return static_cast<uint64>(pthread_self());
}
void LinuxPlatform::SetThreadPriority(ThreadPriority priority)
{
// TODO: impl this

View File

@@ -5,6 +5,7 @@
#if PLATFORM_LINUX
#include "Engine/Platform/Unix/UnixPlatform.h"
#include <pthread.h>
/// <summary>
/// The Linux platform implementation and application management utilities.
@@ -92,7 +93,10 @@ public:
static int32 GetCacheLineSize();
static MemoryStats GetMemoryStats();
static ProcessMemoryStats GetProcessMemoryStats();
static uint64 GetCurrentThreadID();
static uint64 GetCurrentThreadID()
{
return static_cast<uint64>(pthread_self());
}
static void SetThreadPriority(ThreadPriority priority);
static void SetThreadAffinityMask(uint64 affinityMask);
static void Sleep(int32 milliseconds);