SimpleRunningTask< Functor > Class Template Reference

Usage: More...

#include <ArmarXCore/core/services/tasks/TaskUtil.h>

+ Inheritance diagram for SimpleRunningTask< Functor >:

Public Member Functions

void runningFn ()
 
 SimpleRunningTask (Functor f, std::string name="")
 
- Public Member Functions inherited from RunningTask< T >
 RunningTask (T *parent, method_type runningFn, const std::string &name="")
 Constructs a running task within the class parent which calls the runningFn in a new thread.
 
- Public Member Functions inherited from RunningTaskBase
std::string getName () const
 
bool isFinished () const
 Retrieve finished state of the thread.
 
bool isRunning () const
 Retrieve running state of the thread.
 
bool isStopped ()
 Retrieve whether stop() has been called.
 
void join ()
 Wait for the RunningTask to finish without telling it to finish.
 
 RunningTaskBase (std::string const &name)
 
template<typename T>
 RunningTaskBase (T *parent, void(T::*runningFn)(), const std::string &name="")
 Constructs a running task within the class parent which calls the runningFn in a new thread.
 
void setName (const std::string &name)
 
void setThreadList (ThreadListPtr threadList)
 
void start ()
 Starts the thread.
 
void stop (bool waitForJoin=true)
 Stops the thread.
 
bool waitForFinished (int timeoutMS=-1)
 wait blocking for thread to be finished.
 
void waitForStop ()
 Wait blocking for thread until stop() has been called.
 
 ~RunningTaskBase () override
 Destructor stops the thread and waits for completion.
 

Public Attributes

Functor f
 
- Public Attributes inherited from RunningTaskBase
CallbackT callback
 

Additional Inherited Members

- Public Types inherited from RunningTask< T >
typedef void(T::* method_type) (void)
 Typedef for the thread method.
 
using pointer_type = IceUtil::Handle<RunningTask<T>>
 Shared pointer type for convenience.
 
- Public Types inherited from RunningTaskBase
using CallbackT = std::function<void()>
 

Detailed Description

template<class Functor = std::function<void(void)>>
class armarx::SimpleRunningTask< Functor >

Usage:

   SimpleRunningTask<>::pointer_type task = new SimpleRunningTask<>([&]
   {
      ARMARX_INFO << "Hello world from another thread";
   });
   task->start();

Constructor & Destructor Documentation

◆ SimpleRunningTask()

template<class Functor = std::function<void(void)>>
SimpleRunningTask ( Functor f,
std::string name = "" )
inline

Member Function Documentation

◆ runningFn()

template<class Functor = std::function<void(void)>>
void runningFn ( )
inline

Member Data Documentation

◆ f

template<class Functor = std::function<void(void)>>
Functor f

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