2#ifndef POSIX_POSIXTHREAD_H
3#define POSIX_POSIXTHREAD_H
The common base class of Nebula.
Definition refcounted.h:38
Posix implmentation of an event synchronization object.
Definition posixevent.h:20
bool Peek() const
check if event is signalled
Definition posixevent.h:135
Posix implementation of thread class.
Definition posixthread.h:23
Util::String name
Definition posixthread.h:85
Priority
thread priorities
Definition posixthread.h:28
@ Low
Definition posixthread.h:29
@ High
Definition posixthread.h:31
@ Normal
Definition posixthread.h:30
void SetName(const Util::String &n)
set thread name
Definition posixthread.h:136
uint GetThreadAffinity()
get thread affinity
static void YieldThread()
yield the thread (gives up current time slice)
PosixEvent stopRequestEvent
Definition posixthread.h:81
void Start()
start executing the thread code, returns when thread has actually started
Definition posixthread.cc:49
bool running
Definition posixthread.h:82
bool IsRunning() const
return true if thread has been started
Definition posixthread.h:93
static const char * GetMyThreadName()
obtain name of thread from within thread code
Definition posixthread.cc:155
virtual void EmitWakeupSignal()
override this method if your thread loop needs a wakeup call before stopping
Definition posixthread.cc:87
unsigned int stackSize
Definition posixthread.h:84
Priority priority
Definition posixthread.h:83
void SetThreadAffinity(uint mask)
set thread affinity
Definition posixthread.cc:192
unsigned int GetStackSize() const
get stack size
static Threading::ThreadId GetMyThreadId()
get the thread ID of this thread
Definition posixthread.cc:168
virtual ~PosixThread()
destructor
Definition posixthread.cc:34
void Stop()
request threading code to stop, returns when thread has actually finished
Definition posixthread.cc:100
void SetPriority(Priority p)
set the thread priority
Definition posixthread.h:102
__DeclareClass(PosixThread)
void SetStackSize(unsigned int s)
set stack size in bytes (default is 4 KByte)
Priority GetPriority() const
get the thread priority
Definition posixthread.h:111
virtual void DoWork()
this method runs in the thread context
Definition posixthread.cc:127
static void * ThreadProc(void *self)
internal thread proc helper function
Definition posixthread.cc:138
PosixThread()
constructor
Definition posixthread.cc:21
const Util::String & GetName() const
get thread name
Definition posixthread.h:150
pthread_t threadHandle
Definition posixthread.h:79
static ThreadLocal const char * ThreadName
Definition posixthread.h:86
cpu_set_t affinity
Definition posixthread.h:80
bool ThreadStopRequested()
check if stop is requested, call from DoWork() to see if the thread proc should quit
Definition posixthread.h:124
#define n_assert(exp)
Definition debug.h:50
Posix implemention of a read-many write-few lock.
Definition posixsysfunc.cc:21
pthread_t ThreadId
Definition linuxthreadid.h:15
Nebula's universal string class.
Definition string.h:50
bool IsValid() const
return true if string object is not empty
Definition string.h:684
unsigned int uint
Definition types.h:31