1#include <Foundation/FoundationInternal.h>
2PL_FOUNDATION_INTERNAL_HEADER
4#include <Foundation/Threading/ConditionVariable.h>
5#include <Foundation/Threading/ThreadUtils.h>
6#include <Foundation/Time/Time.h>
12static pthread_t g_MainThread = (pthread_t)0;
14void plThreadUtils::Initialize()
16 g_MainThread = pthread_self();
33 SleepTime.tv_nsec = ((plInt64)duration.
GetMilliseconds() * 1000000LL) % 1000000000LL;
34 nanosleep(&SleepTime,
nullptr);
44 return pthread_self();
49 return pthread_self() == g_MainThread;
static void Sleep(const plTime &duration)
Suspends the execution of the current thread for the given amount of time. (Precision may vary accord...
Definition ThreadUtils_Posix.h:29
static void YieldTimeSlice()
Suspends execution of the current thread.
Definition ThreadUtils_Posix.h:19
static bool IsMainThread()
Helper function to check if the current thread is the main thread (e.g. the thread which initialized ...
Definition ThreadUtils_Posix.h:47
static void YieldHardwareThread()
Give resources to other hardware threads on the same processor. Does nothing if the processor has no ...
Definition ThreadUtils_Posix.h:24
static plThreadID GetCurrentThreadID()
Returns an identifier for the currently running thread.
Definition ThreadUtils_Posix.h:42
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
constexpr double GetSeconds() const
Returns the seconds value.
Definition Time_inl.h:30
constexpr double GetMilliseconds() const
Returns the milliseconds value.
Definition Time_inl.h:25