AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface
Public Member Functions | List of all members
drama::thread::KickNotifier Class Reference

Detailed Description

An object used to obtain notifications of kicks.

A KickNotifier object is used to allow blocking threaded action code to be notified if a Kick message is received for the action. This must be executed from a threaded action or a child thread of such an action.

The constructor will create a child thread which will wait for the DRAMA action (specified to the constructor) to be kicked. When kicked, the Kicked() method is invoked (in the context of the child thread). User code can sub-class and override Kicked() as required, or poll via the WasKicked() method to determine if the action has been kicked.

Note
If the KickNotifier thread throws an exception for any reason, the thread will die after printing details on stderr. The user can invoke ThreadThrewException() to find out if this happened. The most likely reason for this is that the user implemented Kicked() method threw an exception.

The destructor will destroy the child thread.

#include "threadaction.hh"

Public Member Functions

 KickNotifier (const KickNotifier &source)=delete
 Copy constructor - deleted.
 
 KickNotifier (TAction *action)
 KickNotifier constructor.
 
virtual ~KickNotifier ()
 Destructor.
 
virtual bool Kicked (const sds::Id &arg)
 Method is invoked when a Kick occurs.
 
KickNotifieroperator= (const KickNotifier &rhs)=delete
 Assignment operator - deleted.
 
bool ThreadThrewException () const
 Return true if the thread has died after thrown an exception.
 
bool WasKicked ()
 Indicates if the action was kicked.
 

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