UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dcf::ThreadCalcBlock Class Reference

#include <thread_calc_block.hpp>

Inheritance diagram for dcf::ThreadCalcBlock:
dcf::CalcBlock

Public Member Functions

 ThreadCalcBlock (const dcf::Manager &manager)
 
virtual ~ThreadCalcBlock ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void wait ()
 
int id () const
 
- Public Member Functions inherited from dcf::CalcBlock
 CalcBlock (const dcf::Manager &manager)
 
 CalcBlock (const dcf::CalcBlock &cb)
 
virtual ~CalcBlock ()
 
virtual bool running () const
 
const dcf::Managermanager () const
 
dcf::error_t resultCode ()
 

Protected Member Functions

virtual void run ()
 
void setStopPoint ()
 
void setThreadStatus (dcf::error_t st)
 
const dcf::error_tgetThreadStatus ()
 
dcf::error_t releaseUnit ()
 

Protected Attributes

bool m_ready
 
- Protected Attributes inherited from dcf::CalcBlock
dcf::Managerm_manager
 
dcf::error_t m_result_code
 

Detailed Description

Thread calculations block.

Constructor & Destructor Documentation

dcf::ThreadCalcBlock::ThreadCalcBlock ( const dcf::Manager manager)

Constructor. Only ThreadManager provides correct working.

virtual dcf::ThreadCalcBlock::~ThreadCalcBlock ( )
virtual

Destructor

Member Function Documentation

const dcf::error_t& dcf::ThreadCalcBlock::getThreadStatus ( )
protected

Get thread calculation result status

int dcf::ThreadCalcBlock::id ( ) const
inline

Id of current thread.

dcf::error_t dcf::ThreadCalcBlock::releaseUnit ( )
protected

Release allocated unit and define status as "not working"

virtual void dcf::ThreadCalcBlock::run ( )
protectedvirtual
Main thread calculation method.

Default implementation sets Deferred type of cancelation. If developer decide to use in reimplemented run() method the functions, that are not safe for asynchronous cancelation, he should run default run() method in his reimplementaion, and then manually define (by means of setStopPoint() method) the points of code, where the cancelation can be applied.

Reimplemented from dcf::CalcBlock.

void dcf::ThreadCalcBlock::setStopPoint ( )
protected
Can be used in run() method to define the time points, 

where the thread can be forcibly canceled without negative consequences. For more information one should read about asynchronous cancellation and async-cancel-safe functions.

void dcf::ThreadCalcBlock::setThreadStatus ( dcf::error_t  st)
protected

Set thread calculation result status

virtual void dcf::ThreadCalcBlock::start ( )
virtual

Initialize thread and start calculations by executing exec() method

Reimplemented from dcf::CalcBlock.

virtual void dcf::ThreadCalcBlock::stop ( )
virtual

Send request for thread termination

Reimplemented from dcf::CalcBlock.

virtual void dcf::ThreadCalcBlock::wait ( )
virtual

Wait for thead work finishing (or thread termination)

Reimplemented from dcf::CalcBlock.

Member Data Documentation

bool dcf::ThreadCalcBlock::m_ready
protected

object status (=true if manager of correct type received)


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