Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/sys/Thread.h>
Public Member Functions | |
virtual | ~Thread (void) |
Runnable & | runnable (void) const |
virtual void | start (void)=0 |
virtual void | join (void)=0 |
virtual void | kill (void)=0 |
virtual bool | isRunning (void)=0 |
Static Public Member Functions | |
static Thread * | make (Runnable &runnable) |
static Thread * | current (void) |
static void | setRootRunnable (Runnable &runnable) |
Protected Member Functions | |
Thread (Runnable &runnable) | |
virtual void | stop (void)=0 |
Protected Attributes | |
Runnable * | _runnable |
Portable thread implementation A thread executes in a concurrent execution flow the given Runnable object.
The threads execution supports:
References Thread::runnable().
Test if the current thread is running.
Kill the current thread: notice that this method does not allow any synchronization, the thread will be killed but guarantee can be done at which program point it will happen.
ThreadException | Thrown if the thread is already dead. |
Build a new portable thread. Notice that the runnable is not executed when the thread is created. It starts only when a call to start() is performed!
bool Mutex::tryLock(void); If the mutex is free, acquire it. Else return immediately without blocking.
SystemException | No more place in waiting queue. Build a new thread for the given runnable. |
References Thread::runnable().
Referenced by JobScheduler::start().
References Thread::_runnable.
Referenced by Runnable::current(), Thread::make(), and Thread::Thread().
Convenient function to set the runnable of root thread.
runnable | Runnable to assign to the root thread. |
Start the execution of the thread and perform the call to Runnable::run(). The thread is stopped when Runnable::run() returns, when it is killed or when the Runnable::run() performs a call to stop.
ThreadException | If no more resources are available for the thread. |
Stop the current thread.
Referenced by Runnable::stop().
|
protected |
Referenced by Thread::runnable().