All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::LThread Class Reference

Special type of "light" non movable thread that runs the lambda function has been provided in the constructor. More...

#include <Thread.h>

+ Inheritance diagram for HSEP::LThread:
+ Collaboration diagram for HSEP::LThread:

Public Member Functions

 LThread (function< bool() > pWorker)
 
- Public Member Functions inherited from HSEP::Thread
 Thread (const char *pType)
 
virtual ~Thread ()
 
const char * namePtr () const
 
bool dispatch ()
 Lets the thread to start working.
 
int join ()
 Wait until the internal thread's memory structures are finished.
 
void finish ()
 Advise the thread for not continuing executing the perform method.
 
bool finishRequested () const
 Indicates if a finish was executed on this thread.
 
void relocate (string pDestination)
 Moves the thread to the specified destination.
 
- Public Member Functions inherited from HSEP::HSEPObject
string & lastErrorRef ()
 Returns a reference to the last stored error message.
 
ErrorCode lastCode ()
 Returns the last stored code.
 
bool valid ()
 Permits to know if the object has a valid internal state.
 
string & typeRef ()
 Permits to know the type of this particular object.
 

Protected Member Functions

bool prepare ()
 Provides a placeholder for the class to initialize internal data.
 
int perform ()
 Performs the internal processing cycle for the thread.
 
void dispose ()
 If the prepare and perform method where successful, the dispose must deinitialize everything was initialized during the prepare method.
 
- Protected Member Functions inherited from HSEP::Thread
 Thread (const char *pType, string &pReceivedState)
 This is the protected constructor will be used by the distributed rebuilder.
 
virtual void d_packState (string &pStateData)
 Permits to package the thread contents to be send to another process or computer to continue working.
 
virtual bool d_sendToDestination (string &pStateData)
 Sends the thread state to the destination.
 
virtual void d_restoreState (string &pSource)
 Rebuilds the internal state for the thread.
 
- Protected Member Functions inherited from HSEP::HSEPObject
 HSEPObject (const char *pType)
 Constructor, providing the base for the state controlling instance.
 
virtual ~HSEPObject ()
 
void setLastError (string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const char *pErrorMsg)
 Assigns an error message text to the last executed operation.
 
void setValid ()
 Defines that the object has a valid state.
 
void setInvalid ()
 Defines that the object has an invalid state.
 
void setLastCode (const ErrorCode pErrorCode)
 Defines the internal result code for the object.
 

Additional Inherited Members

- Protected Attributes inherited from HSEP::Thread
Mutex aMutex
 

Detailed Description

Special type of "light" non movable thread that runs the lambda function has been provided in the constructor.

When the lambda returns "false", the thread finish.

Definition at line 241 of file Thread.h.

Constructor & Destructor Documentation

HSEP::LThread::LThread ( function< bool() >  pWorker)
inline

Definition at line 260 of file Thread.h.

Member Function Documentation

void HSEP::LThread::dispose ( )
inlineprotectedvirtual

If the prepare and perform method where successful, the dispose must deinitialize everything was initialized during the prepare method.

Implements HSEP::Thread.

Definition at line 256 of file Thread.h.

int HSEP::LThread::perform ( )
inlineprotectedvirtual

Performs the internal processing cycle for the thread.

Only works if the prepare method was successful.

Returns
a numeric code that only can be recovered externally on the join method.

Implements HSEP::Thread.

Definition at line 249 of file Thread.h.

bool HSEP::LThread::prepare ( )
inlineprotectedvirtual

Provides a placeholder for the class to initialize internal data.

Returns
true when the initialization was successful.
false when an error that must avoid the thread to run happened.

Implements HSEP::Thread.

Definition at line 245 of file Thread.h.


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