Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR::Thread Class Reference

#include "OVR_Threads.h"

Inheritance diagram for OVR::Thread:
Inheritance graph
Collaboration diagram for OVR::Thread:
Collaboration graph

Data Structures

struct  CreateParams
 

Public Types

enum  ThreadState { NotRunning = 0, Running = 1, Suspended = 2 }
 
enum  ThreadPriority {
  CriticalPriority, HighestPriority, AboveNormalPriority, NormalPriority,
  BelowNormalPriority, LowestPriority, IdlePriority
}
 
typedef int(* ThreadFn )(Thread *pthread, void *h)
 

Public Member Functions

 Thread (UPInt stackSize=128 *1024, int processor=-1)
 
 Thread (ThreadFn threadFunction, void *userHandle=0, UPInt stackSize=128 *1024, int processor=-1, ThreadState initialState=NotRunning)
 
 Thread (const CreateParams &params)
 
virtual ~Thread ()
 
virtual int Run ()
 
virtual void OnExit ()
 
virtual bool Start (ThreadState initialState=Running)
 
virtual void Exit (int exitCode=0)
 
bool Suspend ()
 
bool Resume ()
 
bool GetExitFlag () const
 
void SetExitFlag (bool exitFlag)
 
bool IsFinished () const
 
bool IsSuspended () const
 
ThreadState GetThreadState () const
 
int GetExitCode () const
 
pthread_t GetOSHandle () const
 
ThreadId GetThreadId () const
 
virtual void SetThreadName (const char *name)
 
- Public Member Functions inherited from OVR::RefCountBase< Thread >
OVR_FORCE_INLINE RefCountBase ()
 
- Public Member Functions inherited from OVR::RefCountBaseStatImpl< RefCountImpl >
 RefCountBaseStatImpl ()
 
- Public Member Functions inherited from OVR::RefCountImpl
void AddRef ()
 
void Release ()
 
- Public Member Functions inherited from OVR::RefCountImplCore
OVR_FORCE_INLINE RefCountImplCore ()
 
virtual ~RefCountImplCore ()
 
int GetRefCount () const
 
void operator= (const RefCountImplCore &)
 

Static Public Member Functions

static void OVR_CDECL FinishAllThreads ()
 
static int GetCPUCount ()
 
static int GetOSPriority (ThreadPriority)
 
static bool Sleep (unsigned secs)
 
static bool MSleep (unsigned msecs)
 
- Static Public Member Functions inherited from OVR::RefCountImplCore
static void checkInvalidDelete (RefCountImplCore *)
 

Data Fields

ThreadFn ThreadFunction
 
void * UserHandle
 

Protected Member Functions

int PRun ()
 
void FinishAndRelease ()
 
void Init (const CreateParams &params)
 
 Thread (const Thread &source)
 

Protected Attributes

AtomicInt< UInt32ThreadFlags
 
AtomicInt< SInt32SuspendCount
 
UPInt StackSize
 
int Processor
 
ThreadPriority Priority
 
pthread_t ThreadHandle
 
int ExitCode
 
- Protected Attributes inherited from OVR::RefCountImplCore
volatile int RefCount
 

Static Private Attributes

static int InitAttr = 0
 
static pthread_attr_t Attr
 

Friends

void * Thread_PthreadStartFn (void *phandle)
 

Detailed Description

Definition at line 197 of file OVR_Threads.h.

Member Typedef Documentation

typedef int(* OVR::Thread::ThreadFn)(Thread *pthread, void *h)

Definition at line 207 of file OVR_Threads.h.

Member Enumeration Documentation

Enumerator
CriticalPriority 
HighestPriority 
AboveNormalPriority 
NormalPriority 
BelowNormalPriority 
LowestPriority 
IdlePriority 

Definition at line 223 of file OVR_Threads.h.

Enumerator
NotRunning 
Running 
Suspended 

Definition at line 215 of file OVR_Threads.h.

Constructor & Destructor Documentation

OVR::Thread::Thread ( UPInt  stackSize = 128 * 1024,
int  processor = -1 
)

Definition at line 393 of file OVR_ThreadsPthread.cpp.

OVR::Thread::Thread ( Thread::ThreadFn  threadFunction,
void *  userHandle = 0,
UPInt  stackSize = 128 * 1024,
int  processor = -1,
Thread::ThreadState  initialState = NotRunning 
)

Definition at line 402 of file OVR_ThreadsPthread.cpp.

OVR::Thread::Thread ( const CreateParams params)
explicit

Definition at line 409 of file OVR_ThreadsPthread.cpp.

OVR::Thread::~Thread ( )
virtual

Definition at line 432 of file OVR_ThreadsPthread.cpp.

OVR::Thread::Thread ( const Thread source)
inlineprotected

Definition at line 395 of file OVR_Threads.h.

Member Function Documentation

void OVR::Thread::Exit ( int  exitCode = 0)
virtual

Definition at line 743 of file OVR_ThreadsPthread.cpp.

void OVR::Thread::FinishAllThreads ( )
static

Definition at line 562 of file OVR_ThreadsPthread.cpp.

void OVR::Thread::FinishAndRelease ( )
protected

Definition at line 458 of file OVR_ThreadsPthread.cpp.

int OVR::Thread::GetCPUCount ( )
static

Definition at line 780 of file OVR_ThreadsPthread.cpp.

int OVR::Thread::GetExitCode ( ) const
inline

Definition at line 322 of file OVR_Threads.h.

bool OVR::Thread::GetExitFlag ( ) const

Definition at line 588 of file OVR_ThreadsPthread.cpp.

pthread_t OVR::Thread::GetOSHandle ( ) const
inline

Definition at line 327 of file OVR_Threads.h.

int OVR::Thread::GetOSPriority ( ThreadPriority  p)
static

Definition at line 664 of file OVR_ThreadsPthread.cpp.

ThreadId OVR::Thread::GetThreadId ( ) const
inline

Definition at line 333 of file OVR_Threads.h.

Thread::ThreadState OVR::Thread::GetThreadState ( ) const

Definition at line 614 of file OVR_ThreadsPthread.cpp.

void OVR::Thread::Init ( const CreateParams params)
protected

Definition at line 414 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::IsFinished ( ) const

Definition at line 604 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::IsSuspended ( ) const

Definition at line 609 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::MSleep ( unsigned  msecs)
static

Definition at line 773 of file OVR_ThreadsPthread.cpp.

void OVR::Thread::OnExit ( )
virtual

Definition at line 452 of file OVR_ThreadsPthread.cpp.

int OVR::Thread::PRun ( )
protected

Definition at line 569 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::Resume ( )

Definition at line 736 of file OVR_ThreadsPthread.cpp.

int OVR::Thread::Run ( )
virtual

Reimplemented in OVR::Linux::DeviceManagerThread.

Definition at line 447 of file OVR_ThreadsPthread.cpp.

void OVR::Thread::SetExitFlag ( bool  exitFlag)

Definition at line 593 of file OVR_ThreadsPthread.cpp.

virtual void OVR::Thread::SetThreadName ( const char *  name)
inlinevirtual

Definition at line 349 of file OVR_Threads.h.

bool OVR::Thread::Sleep ( unsigned  secs)
static

Definition at line 767 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::Start ( ThreadState  initialState = Running)
virtual

Definition at line 671 of file OVR_ThreadsPthread.cpp.

bool OVR::Thread::Suspend ( )

Definition at line 729 of file OVR_ThreadsPthread.cpp.

Friends And Related Function Documentation

void* Thread_PthreadStartFn ( void *  phandle)
friend

Definition at line 648 of file OVR_ThreadsPthread.cpp.

Field Documentation

pthread_attr_t OVR::Thread::Attr
staticprivate

Definition at line 360 of file OVR_Threads.h.

int OVR::Thread::ExitCode
protected

Definition at line 385 of file OVR_Threads.h.

int OVR::Thread::InitAttr = 0
staticprivate

Definition at line 359 of file OVR_Threads.h.

ThreadPriority OVR::Thread::Priority
protected

Definition at line 371 of file OVR_Threads.h.

int OVR::Thread::Processor
protected

Definition at line 370 of file OVR_Threads.h.

UPInt OVR::Thread::StackSize
protected

Definition at line 367 of file OVR_Threads.h.

AtomicInt<SInt32> OVR::Thread::SuspendCount
protected

Definition at line 366 of file OVR_Threads.h.

AtomicInt<UInt32> OVR::Thread::ThreadFlags
protected

Definition at line 365 of file OVR_Threads.h.

ThreadFn OVR::Thread::ThreadFunction

Definition at line 210 of file OVR_Threads.h.

pthread_t OVR::Thread::ThreadHandle
protected

Definition at line 381 of file OVR_Threads.h.

void* OVR::Thread::UserHandle

Definition at line 212 of file OVR_Threads.h.


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