Joypad Scol plugin
Public Member Functions | Static Public Attributes | List of all members
openutils::Thread Class Reference

#include <ou_thread.h>

Public Member Functions

 Thread ()
 
 Thread (const char *nm)
 
virtual ~Thread ()
 
void setName (const char *nm)
 
std::string getName () const
 
void start ()
 
virtual void run ()
 
void sleep (long ms)
 
void suspend ()
 
void resume ()
 
void stop ()
 
void setPriority (int p)
 
bool wait (const char *m, long ms=5000)
 
void release (const char *m)
 

Static Public Attributes

static const int P_ABOVE_NORMAL = THREAD_PRIORITY_ABOVE_NORMAL
 
static const int P_BELOW_NORMAL = THREAD_PRIORITY_BELOW_NORMAL
 
static const int P_HIGHEST = THREAD_PRIORITY_HIGHEST
 
static const int P_IDLE = THREAD_PRIORITY_IDLE
 
static const int P_LOWEST = THREAD_PRIORITY_LOWEST
 
static const int P_NORMAL = THREAD_PRIORITY_NORMAL
 
static const int P_CRITICAL = THREAD_PRIORITY_TIME_CRITICAL
 

Detailed Description

class Thread Represents a thread of execution in the process. To create a new Thread write an inherited class ot Thread and override the run() function

Definition at line 52 of file ou_thread.h.

Constructor & Destructor Documentation

◆ Thread() [1/2]

Thread::Thread ( )

@ The Thread class implementation @/

/** Thread() default constructor

Definition at line 63 of file ou_thread.cpp.

◆ Thread() [2/2]

Thread::Thread ( const char *  nm)

Thread(const char* nm) overloaded constructor creates a Thread object identified by "nm"

Definition at line 72 of file ou_thread.cpp.

◆ ~Thread()

Thread::~Thread ( )
virtual

Definition at line 77 of file ou_thread.cpp.

Member Function Documentation

◆ getName()

string Thread::getName ( ) const

getName() return the Thread object's name as a string

Definition at line 93 of file ou_thread.cpp.

◆ release()

void Thread::release ( const char *  m)

release(const char* m)
releases the mutex "m" and makes it available for other threads

Definition at line 207 of file ou_thread.cpp.

◆ resume()

void Thread::resume ( )

resume()
resumes a suspended thread

Definition at line 168 of file ou_thread.cpp.

◆ run()

void Thread::run ( )
virtual

run() called by the thread callback _ou_thread_proc() to be overridden by child classes of Thread

Definition at line 101 of file ou_thread.cpp.

◆ setName()

void Thread::setName ( const char *  nm)

setName(const char* nm) sets the Thread object's name to "nm"

Definition at line 86 of file ou_thread.cpp.

◆ setPriority()

void Thread::setPriority ( int  tp)

setPriority(int tp) sets the priority of the thread to "tp" "tp" must be a valid priority defined in the Thread class

Definition at line 142 of file ou_thread.cpp.

◆ sleep()

void Thread::sleep ( long  ms)

sleep(long ms) holds back the thread's execution for "ms" milliseconds

Definition at line 109 of file ou_thread.cpp.

◆ start()

void Thread::start ( )

start() creates a low-level thread object and calls the run() function

Definition at line 117 of file ou_thread.cpp.

◆ stop()

void Thread::stop ( )

stop() stops the running thread and frees the thread handle

Definition at line 130 of file ou_thread.cpp.

◆ suspend()

void Thread::suspend ( )

suspend()
suspends the thread

Definition at line 155 of file ou_thread.cpp.

◆ wait()

bool Thread::wait ( const char *  m,
long  ms = 5000 
)

wait(const char* m,long ms)
makes the thread suspend execution until the mutex represented by "m" is released by another thread. "ms" specifies a time-out for the wait operation. "ms" defaults to 5000 milli-seconds

Definition at line 184 of file ou_thread.cpp.

Member Data Documentation

◆ P_ABOVE_NORMAL

const int Thread::P_ABOVE_NORMAL = THREAD_PRIORITY_ABOVE_NORMAL
static

Definition at line 80 of file ou_thread.h.

◆ P_BELOW_NORMAL

const int Thread::P_BELOW_NORMAL = THREAD_PRIORITY_BELOW_NORMAL
static

Definition at line 81 of file ou_thread.h.

◆ P_CRITICAL

const int Thread::P_CRITICAL = THREAD_PRIORITY_TIME_CRITICAL
static

Definition at line 86 of file ou_thread.h.

◆ P_HIGHEST

const int Thread::P_HIGHEST = THREAD_PRIORITY_HIGHEST
static

Definition at line 82 of file ou_thread.h.

◆ P_IDLE

const int Thread::P_IDLE = THREAD_PRIORITY_IDLE
static

Definition at line 83 of file ou_thread.h.

◆ P_LOWEST

const int Thread::P_LOWEST = THREAD_PRIORITY_LOWEST
static

Definition at line 84 of file ou_thread.h.

◆ P_NORMAL

const int Thread::P_NORMAL = THREAD_PRIORITY_NORMAL
static

Definition at line 85 of file ou_thread.h.


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