|
Public Types |
enum | State {
Created,
Running,
Suspended,
Terminated,
Detached
} |
Public Member Functions |
| Thread (IN(RRunnable) target=Nil, IN(RString) name=Nil) |
| Construct an user Thread.
|
| Thread (IN(RThreadGroup) group, IN(RRunnable) target=Nil, IN(RString) name=Nil) |
| Construct an user Thread.
|
| Thread (ThreadType type, IN(RString) name=Nil) |
| Construct an system or main Thread.
|
virtual | ~Thread () |
virtual RString | toString () |
| reimplemented from String
|
virtual void | join (int millis=-1, int nanos=0) throw ( RIllegalArgumentException ) |
virtual void | interrupt () |
| Interrupt this thread.
|
virtual bool | isInterrupted () |
| return true if this thread has interrupted signal set
|
bool | isAlive () |
| return true if thread is running
|
virtual void | start () |
| start the thread
|
virtual void | run () |
| overload this method to implement working code for this thread
|
virtual int | getPriority () |
| return the priority of this thread
|
virtual void | setPriority (int newPriority) |
| sets the priority of this thread 0 (hight) - 5 (low)
|
RThreadGroup | getThreadGroup () |
| return the threadgroup associated with this thread
|
int | getActiveCount () |
| non static version of activeCount()
|
virtual int | countStackFrames () |
| return stack frames in this thread.
|
virtual void | destroy () |
| Kills this thread, without releasing any resource.
|
virtual void | stop () |
| calls stop(new ThreadDeath())
|
virtual void | stop (IN(RThrowable) exception) |
| The given exception will be thrown in the thread either it is in a waiting situation (inside wait, sleep, join, etc.) or the thread is calling the Thread::checkForPendingException().
|
virtual void | suspend () |
| Suspends the thread.
|
virtual void | resume () |
| weak up thread previously suspended with suspend()
|
virtual void | setDaemon (bool on) |
| set this thread to a deamon thread
|
virtual bool | isDaemon () |
virtual void | setName (RString str) |
void | doSleep (int millis) |
| internal helper
|
void | _saveStackBase (unsigned int sp) |
| System should be friend of it, but include-chain disallows it.
|
void | setThreadExceptionToThrow (IN(RThrowable) ex) |
| after basic operations (like sleep) it calls checkForThreadException() and if a throwable was set with setThreadExceptionToThrow this exception will be raised
|
RThrowable | getThreadExceptionToThrow () |
void | checkForThreadException () |
| throws a previously set exception - Exceptions:
-
|
bool | _readResetIsInterrupted () |
| internal helper
|
void | setCurrentWaitingMonitor (MonitorInterface *monitor) |
Thread::State | _getState () const |
void | _setState (Thread::State state) |
ThreadID | threadID () |
const ThreadID | threadID () const |
HANDLE | threadHandle () |
bool | _isThisThreadCurrent () |
Static Public Member Functions |
bool | interrupted () |
| return true if currentThread() is interrupted
|
void | yield () |
| force switch to another thread
|
void | sleep (int millis, int nanaos=0) |
| Sleep the current threads.
|
RThread | currentThread () |
| return the current thread
|
int | activeCount () |
| delegate to ThreadGroup::activeCount if exists otherwise return 1
|
unsigned int | getStackBase () |
int | enumerate (IN(RThreadArray) tarray) |
| List all threads of current threadgroup.
|
void | dumpStack () |
| calls acdk::lang::System::printStackTrace()
|
int | getThreadCount () |
| return the known threads, whereas main thread not included
|
void | newSystemThread (ThreadType type=SystemThreadType) |
| a new system thread was dedected
|
void | removeSystemThread () |
| remove this system thread
|
void | checkSystemThreads () |
| checks if all thread are registered, removes zombies
|
bool | isSingleThreaded () |
void | checkForPendingException () |
| calls currentThread()->checkForThreadException()
|
void | setCurrentMonitor (MonitorInterface *monitor) |
| set current waiting monitor
|
unsigned int _stdcall | _Win32ThreadFunc (void *arg) |
ThreadID | currentThreadId () |
Public Attributes |
HANDLE | _threadHandle |
Protected Member Functions |
void | _invokeThreadException () |
void | _run () |
void | _checkAccess () |
Protected Attributes |
ThreadID | _threadID |
Private Types |
typedef sys::core_fastmutex | InternalMutexType |
| for protecting setting/reading internal state
|
Static Private Member Functions |
void * | _posixThreadFunc (void *arg) |
Private Attributes |
RRunnable | _runnable |
RString | _name |
Thread::State | _state |
bool | _isDaemon |
bool | _interrupted |
| thread should be interrupted
|
MonitorInterface * | _currentMonitor |
| this lock is currently waiting
|
ThreadType | _type |
RThreadGroup | _group |
RThrowable | _exceptionToThrow |
InternalMutexType | _internalMutex |
RObject | _startSync |
| used to wait in start until Thread finisished initializing
|
Static Private Attributes |
sys::core_atomicop | _threadCount |