commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::Thread Class Reference

#include <Thread.h>

+ Inheritance diagram for commore::Thread:

Classes

struct  Impl
 

Public Member Functions

 Thread ()
 
virtual ~Thread ()
 
bool start ()
 
bool request_stop ()
 
bool stop ()
 
bool is_to_stop ()
 
bool is_stopped ()
 
bool is_running ()
 
virtual void run ()
 
bool wait (TimePeriod timeout)
 
bool trigger ()
 
virtual void run_item ()
 

Detailed Description

A simple Thread commore implementation

Constructor & Destructor Documentation

commore::Thread::Thread ( )
inline
Thread::~Thread ( )
virtual

Member Function Documentation

bool Thread::is_running ( )
Returns
true if thread is running
Remarks
thread initial state is not runing
bool Thread::is_stopped ( )
Returns
true if thread is stopped
Remarks
thread initial state is stopped
bool Thread::is_to_stop ( )
Returns
true if stop flag is true
bool Thread::request_stop ( )

Set the stop flag to true.

void Thread::run ( )
virtual

The main thread function. The method is call on start method by created system thread. The thread terminate when this method end. Must be implemented by derived class.

Remarks
The implementation must constantly check the stop flag to allow graceful stop.

Reimplemented in SHMListener, SHMConnectionServer, TCPIPListenerBucket, and commore::ThreadActor.

void Thread::run_item ( )
virtual

Launched by the default run() implementation each time the the thread is triggered. So this function is designed for short action. In anny case all loop MUST have is_to_stop() as stop condition.

bool Thread::start ( )

Start running thread

bool Thread::stop ( )

Set the stop flag and wait effective stop

Remarks
there is no timeout
bool Thread::trigger ( )

Force thread to end wait or start a run_item

bool Thread::wait ( TimePeriod  timeout)

To be used ONLY in run or run_item function wait for time period OR stop flag is set OR trigger call


The documentation for this class was generated from the following files: