RavEngine
Loading...
Searching...
No Matches
physx::PxThreadImpl Class Reference

Public Types

typedef size_t Id
 
typedef void *(* ExecuteFn) (void *)
 

Public Member Functions

 PxThreadImpl ()
 
 PxThreadImpl (ExecuteFn fn, void *arg, const char *name)
 
 ~PxThreadImpl ()
 
void start (PxU32 stackSize, PxRunnable *r)
 
void kill ()
 
void signalQuit ()
 
bool waitForQuit ()
 
bool quitIsSignalled ()
 
void quit ()
 
PxU32 setAffinityMask (PxU32 mask)
 
void setPriority (PxThreadPriority::Enum prio)
 
void setName (const char *name)
 

Static Public Member Functions

static PxU32 getDefaultStackSize ()
 
static Id getId ()
 
static PxThreadPriority::Enum getPriority (Id threadId)
 
static void sleep (PxU32 ms)
 
static void yield ()
 
static void yieldProcessor ()
 
static PxU32 getNbPhysicalCores ()
 
static PxU32 getSize ()
 

Constructor & Destructor Documentation

◆ PxThreadImpl() [1/2]

physx::PxThreadImpl::PxThreadImpl ( )

Construct (but do not start) the thread object. The OS thread object will not be created until start() is called. Executes in the context of the spawning thread.

◆ PxThreadImpl() [2/2]

physx::PxThreadImpl::PxThreadImpl ( PxThreadImpl::ExecuteFn  fn,
void *  arg,
const char *  name 
)

Construct and start the the thread, passing the given arg to the given fn. (pthread style)

◆ ~PxThreadImpl()

physx::PxThreadImpl::~PxThreadImpl ( )

Deallocate all resources associated with the thread. Should be called in the context of the spawning thread.

Member Function Documentation

◆ getNbPhysicalCores()

uint32_t physx::PxThreadImpl::getNbPhysicalCores ( )
static

Return the number of physical cores (does not include hyper-threaded cores), returns 0 on failure

◆ getSize()

uint32_t physx::PxThreadImpl::getSize ( )
static

Size of this class.

◆ kill()

void physx::PxThreadImpl::kill ( )

Violently kill the current thread. Blunt instrument, not recommended since it can leave all kinds of things unreleased (stack, memory, mutexes...) Should be called in the context of the spawning thread.

◆ quit()

void physx::PxThreadImpl::quit ( )

Cleanly shut down this thread. Called in the context of the spawned thread.

◆ quitIsSignalled()

bool physx::PxThreadImpl::quitIsSignalled ( )

check whether the thread is signalled to quit. Called in the context of the spawned thread.

◆ setAffinityMask()

uint32_t physx::PxThreadImpl::setAffinityMask ( PxU32  mask)

Change the affinity mask for this thread. The mask is a platform specific value.

On Windows, Linux, and Switch platforms, each set mask bit represents the index of a logical processor that the OS may schedule thread execution on. Bits outside the range of valid logical processors may be ignored or cause the function to return an error.

On Apple platforms, this function has no effect.

If the thread has not yet been started then the mask is stored and applied when the thread is started.

If the thread has already been started then this method returns the previous affinity mask on success, otherwise it returns zero.

◆ setName()

void physx::PxThreadImpl::setName ( const char *  name)

set the thread's name

◆ setPriority()

void physx::PxThreadImpl::setPriority ( PxThreadPriority::Enum  prio)

Set thread priority.

◆ signalQuit()

void physx::PxThreadImpl::signalQuit ( )

Stop the thread. Signals the spawned thread that it should stop, so the thread should check regularly

◆ sleep()

void physx::PxThreadImpl::sleep ( PxU32  ms)
static

Put the current thread to sleep for the given number of milliseconds

◆ start()

void physx::PxThreadImpl::start ( PxU32  stackSize,
PxRunnable *  r 
)

Create the OS thread and start it running. Called in the context of the spawning thread. If an affinity mask has previously been set then it will be applied after the thread has been created.

◆ waitForQuit()

bool physx::PxThreadImpl::waitForQuit ( )

Wait for a thread to stop. Should be called in the context of the spawning thread. Returns false if the thread has not been started.

◆ yield()

void physx::PxThreadImpl::yield ( )
static

Yield the current thread's slot on the CPU

◆ yieldProcessor()

void physx::PxThreadImpl::yieldProcessor ( )
static

Inform the processor that we're in a busy wait to give it a chance to do something clever. yield() yields the thread, while yieldProcessor() aims to yield the processor


The documentation for this class was generated from the following files: