Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
gts::Thread Class Reference

A wrapper around the platform's threading system. More...

#include <Thread.h>

Public Types

enum class  Priority : int32_t {
  PRIORITY_HIGHEST = GTS_THREAD_PRIORITY_HIGHEST , PRIORITY_ABOVE_NORMAL = GTS_THREAD_PRIORITY_ABOVE_NORMAL , PRIORITY_NORMAL = GTS_THREAD_PRIORITY_NORMAL , PRIORITY_BELOW_NORMAL = GTS_THREAD_PRIORITY_BELOW_NORMAL ,
  PRIORITY_LOWEST = GTS_THREAD_PRIORITY_LOWEST
}
 
enum  { DEFAULT_STACK_SIZE = 0 }
 

Public Member Functions

GTS_INLINE bool start (ThreadFunction function, void *pArg, uint32_t stackSize=DEFAULT_STACK_SIZE)
 Starts a thread.
 
GTS_INLINE bool join ()
 
GTS_INLINE bool destroy ()
 Destroys the internal resource, if any.
 
GTS_INLINE ThreadId getId ()
 Returns the handle's unique ID.
 
GTS_INLINE bool setAffinity (size_t groupId, AffinitySet const &affinity)
 Sets the processor affinity for the thread and returns the previous affinity.
 
GTS_INLINE bool setPriority (Priority priority)
 Sets the priority for the thread.
 

Static Public Member Functions

static GTS_INLINE void getSystemTopology (SystemTopology &out)
 Gets the topology of all the processors in the system.
 
static GTS_INLINE uint32_t getHardwareThreadCount ()
 Gets the number of logical processor on this system.
 
static GTS_INLINE void getCurrentProcessorId (uint32_t &groupId, uint32_t &hwTid)
 Gets the current group and hardware thread IDs.
 

Detailed Description

A wrapper around the platform's threading system.