YARP  2.3.70
Yet Another Robot Platform
yarp::os::MpiControlThread Class Reference

#include <mpi_carrier/include/yarp/os/MpiComm.h>

+ Inheritance diagram for yarp::os::MpiControlThread:

Public Member Functions

 MpiControlThread ()
 
void finalize ()
 
bool threadInit () override
 Initialization method. More...
 
void run () override
 Main body of the new thread. More...
 
void threadRelease () override
 Release method. More...
 
- Public Member Functions inherited from yarp::os::Thread
 Thread ()
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
virtual void onStop ()
 Call-back, called while halting the thread (before join). More...
 
bool start ()
 Start the new thread running. More...
 
bool stop ()
 Stop the thread. More...
 
virtual void beforeStart ()
 Called just before a new thread starts. More...
 
virtual void afterStart (bool success)
 Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). More...
 
bool isStopping ()
 Returns true if the thread is stopping (Thread::stop has been called). More...
 
bool isRunning ()
 Returns true if the thread is running (Thread::start has been called successfully and the thread has not stopped). More...
 
void setOptions (int stackSize=0)
 Set the stack size for the new thread. More...
 
long int getKey ()
 Get a unique identifier for the thread. More...
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that. More...
 
int getPriority ()
 Query the current priority of the thread, if the OS supports that. More...
 
int getPolicy ()
 Query the current scheduling policy of the thread, if the OS supports that. More...
 
bool join (double seconds=-1)
 The function returns when the thread execution has completed. More...
 

Private Attributes

bool terminate
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Thread
static int getCount ()
 Check how many threads are running. More...
 
static long int getKeyOfCaller ()
 Get a unique identifier for the calling thread. More...
 
static void setDefaultStackSize (int stackSize)
 Set the default stack size for all threads created after this point. More...
 
static void yield ()
 Reschedule the execution of current thread, allowing other threads to run. More...
 

Detailed Description

Definition at line 31 of file MpiComm.h.

Constructor & Destructor Documentation

◆ MpiControlThread()

yarp::os::MpiControlThread::MpiControlThread ( )
inline

Definition at line 34 of file MpiComm.h.

Member Function Documentation

◆ finalize()

void yarp::os::MpiControlThread::finalize ( )
inline

Definition at line 35 of file MpiComm.h.

◆ run()

void yarp::os::MpiControlThread::run ( )
inlineoverridevirtual

Main body of the new thread.

Override this method to do what you want. After Thread::start is called, this method will start running in a separate thread. It is important that this method either keeps checking Thread::isStopping to see if it should stop, or you override the Thread::onStop method to interact with it in some way to shut the new thread down. There is no really reliable, portable way to stop a thread cleanly unless that thread cooperates.

Implements yarp::os::Thread.

Definition at line 38 of file MpiComm.h.

◆ threadInit()

bool MpiControlThread::threadInit ( )
overridevirtual

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 class and passed as a parameter to afterStart(). Note that afterStart() is called by the same thread that is executing the "start" method.

Reimplemented from yarp::os::Thread.

Definition at line 50 of file MpiComm.cpp.

◆ threadRelease()

void MpiControlThread::threadRelease ( )
overridevirtual

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).

Reimplemented from yarp::os::Thread.

Definition at line 44 of file MpiComm.cpp.

Member Data Documentation

◆ terminate

bool yarp::os::MpiControlThread::terminate
private

Definition at line 32 of file MpiComm.h.


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