YARP
Yet Another Robot Platform
yarp::os::Runnable Class Reference

A class that can be managed by another thread. More...

#include <yarp/os/Runnable.h>

Public Member Functions

virtual ~Runnable ()
 Destructor. More...
 
virtual void run ()
 Body to run - could be periodic or continuous. More...
 
virtual void close ()
 User-defined procedure for stopping execution. More...
 
virtual void beforeStart ()
 Should be called from the creator before the thread exists and before a call that requested the thread returns. More...
 
virtual void afterStart (bool success)
 Should be called from the creator after the thread exists and before a call that requested the thread returns. More...
 
virtual bool threadInit ()
 Initialization method. More...
 
virtual void threadRelease ()
 Release method. More...
 

Detailed Description

A class that can be managed by another thread.

Deprecated:
since YARP 3.3

Definition at line 28 of file Runnable.h.

Constructor & Destructor Documentation

◆ ~Runnable()

yarp::os::Runnable::~Runnable ( )
virtualdefault

Destructor.

Member Function Documentation

◆ afterStart()

void yarp::os::Runnable::afterStart ( bool  success)
virtual

Should be called from the creator after the thread exists and before a call that requested the thread returns.

Definition at line 28 of file Runnable.cpp.

◆ beforeStart()

void yarp::os::Runnable::beforeStart ( )
virtual

Should be called from the creator before the thread exists and before a call that requested the thread returns.

Definition at line 24 of file Runnable.cpp.

◆ close()

void yarp::os::Runnable::close ( )
virtual

User-defined procedure for stopping execution.

There is no general-purpose way to achieve that.

Definition at line 20 of file Runnable.cpp.

◆ run()

void yarp::os::Runnable::run ( )
virtual

Body to run - could be periodic or continuous.

Definition at line 16 of file Runnable.cpp.

◆ threadInit()

bool yarp::os::Runnable::threadInit ( )
virtual

Initialization method.

The thread executes this function when it starts and before "run". This is a good place to perform initialization tasks that need to be done by the thread itself (device drivers initialization, memory allocation etc). If the function returns false the thread quits and never calls "run". The return value of threadInit() is notified to the thread class and passed as a parameter to afterStart(). Note that afterStart() is called by the same thread that is executing the start method.

Definition at line 33 of file Runnable.cpp.

◆ threadRelease()

void yarp::os::Runnable::threadRelease ( )
virtual

Release method.

The thread executes this function once when it exits, after the last "run". This is a good place to release resources that were initialized in threadInit() (release memory, and device driver resources).

Definition at line 38 of file Runnable.cpp.


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