RavEngine
Loading...
Searching...
No Matches
physx::PxThreadT< Alloc > Class Template Reference

#include <PxThread.h>

Inheritance diagram for physx::PxThreadT< Alloc >:
[legend]
Collaboration diagram for physx::PxThreadT< Alloc >:
[legend]

Public Types

typedef PxThreadImpl::Id Id
 

Public Member Functions

 PxThreadT (const Alloc &alloc=Alloc())
 
 PxThreadT (PxThreadImpl::ExecuteFn fn, void *arg, const char *name, const Alloc &alloc=Alloc())
 
virtual ~PxThreadT ()
 
void start (PxU32 stackSize=PxThreadImpl::getDefaultStackSize())
 
void kill ()
 
virtual void execute (void)
 
void signalQuit ()
 
bool waitForQuit ()
 
bool quitIsSignalled ()
 
void quit ()
 
PxU32 setAffinityMask (PxU32 mask)
 
void setPriority (PxThreadPriority::Enum prio)
 
void setName (const char *name)
 
- Public Member Functions inherited from physx::PxUserAllocated
PX_INLINE void * operator new (size_t, void *address)
 
PX_INLINE void operator delete (void *, void *)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete (void *ptr, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line)
 
PX_INLINE void operator delete (void *ptr)
 
PX_INLINE void operator delete[] (void *ptr)
 

Static Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from physx::PxReflectionAllocator< T >
 PxReflectionAllocator (const PxEMPTY)
 
 PxReflectionAllocator (const char *=0)
 
 PxReflectionAllocator (const PxReflectionAllocator &)
 
PX_FORCE_INLINE void * allocate (size_t size, const char *filename, int line)
 
PX_FORCE_INLINE void deallocate (void *ptr)
 
- Protected Member Functions inherited from physx::PxUserAllocated
PX_INLINE void * operator new (size_t, void *address)
 
PX_INLINE void operator delete (void *, void *)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete (void *ptr, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line)
 
PX_INLINE void operator delete (void *ptr)
 
PX_INLINE void operator delete[] (void *ptr)
 

Detailed Description

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
class physx::PxThreadT< Alloc >

Thread abstraction API

Constructor & Destructor Documentation

◆ PxThreadT() [1/2]

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
physx::PxThreadT< Alloc >::PxThreadT ( const Alloc &  alloc = Alloc())
inline

Construct (but do not start) the thread object. Executes in the context of the spawning thread

◆ PxThreadT() [2/2]

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
physx::PxThreadT< Alloc >::PxThreadT ( PxThreadImpl::ExecuteFn  fn,
void *  arg,
const char *  name,
const Alloc &  alloc = Alloc() 
)
inline

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

◆ ~PxThreadT()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
virtual physx::PxThreadT< Alloc >::~PxThreadT ( )
inlinevirtual

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

Member Function Documentation

◆ execute()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
virtual void physx::PxThreadT< Alloc >::execute ( void  )
inlinevirtual

The virtual execute() method is the user defined function that will run in the new thread. Called in the context of the spawned thread.

Reimplemented from physx::PxRunnable.

Reimplemented in physx::Ext::CpuWorkerThread, and physx::SnippetUtils::Thread.

◆ kill()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::kill ( )
inline

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()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::quit ( )
inline

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

◆ quitIsSignalled()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
bool physx::PxThreadT< Alloc >::quitIsSignalled ( )
inline

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

◆ setName()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::setName ( const char *  name)
inline

set the thread's name

◆ setPriority()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::setPriority ( PxThreadPriority::Enum  prio)
inline

Set thread priority.

◆ signalQuit()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::signalQuit ( )
inline

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

◆ sleep()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
static void physx::PxThreadT< Alloc >::sleep ( PxU32  ms)
inlinestatic

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

◆ start()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
void physx::PxThreadT< Alloc >::start ( PxU32  stackSize = PxThreadImpl::getDefaultStackSize())
inline

start the thread running. Called in the context of the spawning thread.

◆ waitForQuit()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
bool physx::PxThreadT< Alloc >::waitForQuit ( )
inline

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()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
static void physx::PxThreadT< Alloc >::yield ( )
inlinestatic

Yield the current thread's slot on the CPU

◆ yieldProcesor()

template<typename Alloc = PxReflectionAllocator<PxThreadImpl>>
static void physx::PxThreadT< Alloc >::yieldProcesor ( )
inlinestatic

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 file: