Fawkes API  Fawkes Development Version
fawkes::BlockedTimingExecutor Class Referenceabstract

Blocked timing executor. More...

#include <>>

Inheritance diagram for fawkes::BlockedTimingExecutor:

Public Member Functions

virtual ~BlockedTimingExecutor ()
 Virtual empty destructor. More...
 
virtual void wakeup_and_wait (BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec=0)=0
 Wakeup thread for given hook and wait for completion. More...
 
virtual void wakeup (BlockedTimingAspect::WakeupHook hook, Barrier *barrier=0)=0
 Wakeup thread for given hook. More...
 
virtual void try_recover (std::list< std::string > &recovered_threads)=0
 Try to recover threads. More...
 
virtual bool timed_threads_exist ()=0
 Check if any timed threads exist. More...
 
virtual void wait_for_timed_threads ()=0
 Wait for timed threads. More...
 
virtual void interrupt_timed_thread_wait ()=0
 Interrupt any currently running wait_for_timed_threads() and cause it to throw an InterruptedException. More...
 

Detailed Description

Blocked timing executor.

This interface defines access to threads with the blocked timing aspect.

Author
Tim Niemueller

Definition at line 35 of file executor.h.

Constructor & Destructor Documentation

◆ ~BlockedTimingExecutor()

fawkes::BlockedTimingExecutor::~BlockedTimingExecutor ( )
virtual

Virtual empty destructor.

Definition at line 81 of file executor.cpp.

Member Function Documentation

◆ interrupt_timed_thread_wait()

void fawkes::BlockedTimingExecutor::interrupt_timed_thread_wait ( )
pure virtual

Interrupt any currently running wait_for_timed_threads() and cause it to throw an InterruptedException.

Implemented in fawkes::ThreadManager.

◆ timed_threads_exist()

bool fawkes::BlockedTimingExecutor::timed_threads_exist ( )
pure virtual

Check if any timed threads exist.

Returns
true if threads exist that need to be woken up for execution, false otherwise

Implemented in fawkes::ThreadManager.

◆ try_recover()

void fawkes::BlockedTimingExecutor::try_recover ( std::list< std::string > &  recovered_threads)
pure virtual

Try to recover threads.

An advanced BlockedTimingExecutor might be able to detect deadlocked threads. In this case this function should be called regularly to allow for recovering threads that are back to normal operation.

Parameters
recovered_threadsupon return the names of any threads that could be recovered from a bad state have been added to the list.

Implemented in fawkes::ThreadManager.

◆ wait_for_timed_threads()

void fawkes::BlockedTimingExecutor::wait_for_timed_threads ( )
pure virtual

Wait for timed threads.

Use this method to wait until a timed that is added to the thread manager. Note that an InterruptedException is thrown if interrup_timed_thread_wait() is called from another thread. You should catch this exception and stop the loop execution.

Exceptions
InterruptedExceptionthrown if another thread calls interrupt_timed_thread_wait()

Implemented in fawkes::ThreadManager.

◆ wakeup()

void fawkes::BlockedTimingExecutor::wakeup ( BlockedTimingAspect::WakeupHook  hook,
Barrier barrier = 0 
)
pure virtual

Wakeup thread for given hook.

This will wakeup all threads registered for the given hook. With the optional barrier you can synchronize to the end of the loop execution of the threads of the given hook.

Parameters
hookhook for which to wait for
barrieroptional barrier that can be used to synchronize to the end of the loop execution of the threads.

Implemented in fawkes::ThreadManager.

◆ wakeup_and_wait()

void fawkes::BlockedTimingExecutor::wakeup_and_wait ( BlockedTimingAspect::WakeupHook  hook,
unsigned int  timeout_usec = 0 
)
pure virtual

Wakeup thread for given hook and wait for completion.

This will wakeup all threads registered for the given hook. Afterwards this method will block until all threads finished their loop.

Parameters
hookhook for which to wait for
timeout_usectimeout for thread execution in usec. 0 disables the timeout and makes this function to wait forever.
Exceptions
Exceptionthrown if the timeout was exceeded (at least one of the threads for the given hook took longer than the desired time.

Implemented in fawkes::ThreadManager.

Referenced by TimeTrackerMainLoopThread::loop().


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