#include <thread.h>
Inheritance diagram for Yagl::Thread:

Public Member Functions | |
| Thread () | |
| Constructor. | |
| virtual | ~Thread () |
| Destructor. | |
| virtual void * | run () |
| the threaded method | |
| bool | start () |
| starts the thread | |
| void | stop () |
| stops the thread | |
| void | join () |
| joins the thread | |
| void | kill () |
| ungracefully stops a thread | |
Static Public Member Functions | |
| static void | yield () |
| yields the current thread | |
| static void | sleep (unsigned int msecs) |
| sleeps for msecs | |
Protected Member Functions | |
| Thread (const Thread &thread) | |
Protected Attributes | |
| THREAD_STATUS | status_ |
| status of the thread see THREAD_STATUS enumeration | |
|
|
copy constructor hidden |
|
|
Constructor. sets the members to initial states |
|
|
Destructor. if the thread is runnin it will be ungracefully killed. it is recommended to use stop() before the destructor is called |
|
|
joins the thread this method will join a thread. that means the thread that calls this method will be put to sleep until the joined thread has quit. this will never return if the thread does not quit. |
|
|
ungracefully stops a thread this method will kill a thread explicitely not waiting for it to quit itself. only use this in exceptional situations where the thread has to be stoped. using this method can cause memory leaks and other nasty problems as the thread is interrupted and has no chance to clean up. |
|
|
the threaded method This method is the one that will be the thread. it can return a void* pointer but there's no mechanims yet to report that return value to a calling application if you inherit from this class this is the one method that has to be overwritten. as an implementor of this method you have to make sure to react on changes of the status_ member that will denote if the thread has to be stopped. in general, if status_ changes to THREAD_STATUS::STOP then make sure to exit the thread ( with cleaning up what needs cleanup of course ) Reimplemented in Yagl::SfxDevice, Yagl::GlGfxKeyboard, Yagl::BiDirectionalConnection, and Yagl::ListeningConnection. |
|
|
sleeps for msecs this is a static method that gives the user the possibility to put the current thread to sleep. the thread will not execute for msecs and give processing time to other threads and processes by this.
|
|
|
starts the thread this will start the threads main function if it is not already running |
|
|
stops the thread this method will stop the thread by setting status_ to STOP and then join the thread. thus it will wait until the thread exited. make sure that you exit within the run method if status_ is set to STOP or this method will wait forever. |
|
|
yields the current thread this is a static method ( that is not associated with a Thread instance ) that gives the user the possibility to yield. yielding means that the scheduler of the os is told to schedule another thread other than the current thread you can call this from wherever you want in order to give more processing time to other processses and threads |
1.4.5