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

#include <Thread.h>

Public Member Functions

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

Member Function Documentation

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

Set the stop flag to true.

virtual void commore::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.
virtual void commore::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 commore::Thread::start ( )

Start running thread

bool commore::Thread::stop ( )

Set the stop flag and wait effective stop

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

Force thread to end wait or start a run_item

bool commore::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 file: