#include <thread_obj.h>


Public Member Functions | |
| ThreadObj (std::string name) | |
| Constructor. | |
| virtual | ~ThreadObj () |
| void | Start () |
| Start the Main method in a separate thread. | |
| void | Stop () |
| Ask the thread to stop. | |
| void | Kill () |
| Kill the thread. | |
| virtual void | OnStart () |
| Method called when a call to Start is done. | |
| virtual void | OnStop () |
| Method called when a call to Stop is done. | |
| bool | GetStopped () |
| Check whether the object has already been started. | |
Static Public Member Functions | |
| static void * | StartThread (void *) |
Public Attributes | |
| pthread_t | id |
| std::string | name |
Protected Member Functions | |
| virtual void | Main ()=0 |
| Main method executed in a separate thread. | |
| bool | GetAskStop () |
| Check whether the thread was asked to stop (by a user request). | |
Thread
Definition at line 11 of file thread_obj.h.
| ThreadObj::ThreadObj | ( | std::string | name | ) |
Constructor.
| name | std::string to specify the name of the thread. This parameter is used as a prefix to loglines. |
Definition at line 18 of file thread_obj.cpp.
| ThreadObj::~ThreadObj | ( | ) | [virtual] |
Definition at line 28 of file thread_obj.cpp.
| bool ThreadObj::GetAskStop | ( | ) | [protected] |
Check whether the thread was asked to stop (by a user request).
Definition at line 109 of file thread_obj.cpp.
| bool ThreadObj::GetStopped | ( | ) |
Check whether the object has already been started.
Definition at line 117 of file thread_obj.cpp.
| void ThreadObj::Kill | ( | ) |
Kill the thread.
The execution of the Main method is interrupted.
Definition at line 73 of file thread_obj.cpp.
| virtual void ThreadObj::Main | ( | ) | [protected, pure virtual] |
Main method executed in a separate thread.
This method is executed in a separate thread when a call to Start is done.
Implemented in FastLoopThreadObj, and LoopThreadObj.
| virtual void ThreadObj::OnStart | ( | ) | [inline, virtual] |
Method called when a call to Start is done.
Method called from the thread newly created before the Main method is called.
Reimplemented in FastLoopThreadObj.
Definition at line 63 of file thread_obj.h.
| virtual void ThreadObj::OnStop | ( | ) | [inline, virtual] |
Method called when a call to Stop is done.
Method called from the thread that is about to exit, after the Main method exited. This method is not called when the thread is stopped with the Kill method.
Reimplemented in FastLoopThreadObj, and Server< A >.
Definition at line 70 of file thread_obj.h.
| void ThreadObj::Start | ( | ) |
| void * ThreadObj::StartThread | ( | void * | arg | ) | [static] |
Definition at line 50 of file thread_obj.cpp.
| void ThreadObj::Stop | ( | ) |
Ask the thread to stop.
In order to use this method, the Main method has to implement cancelation by checking the value returned by GetAskStop.
Definition at line 125 of file thread_obj.cpp.
| pthread_t ThreadObj::id |
Definition at line 33 of file thread_obj.h.
| std::string ThreadObj::name |
Definition at line 34 of file thread_obj.h.
1.5.8