AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ Kicked()

virtual bool drama::thread::KickNotifier::Kicked ( const sds::Id arg)
virtual

Method is invoked when a Kick occurs.

User code can override this in a sub-class to arrange to be notified when a kick occurs.

A sub-class author must determine the sensible thing to do when this is invoked, which will depend on why the action code is blocked. They may need to cancel I/O or break out of a CPU intensive operation. The most dramatic approach would be to use setjmp() and longjmp(), but in that case care must be taken over the management of resources (i.e. don't jump such as to avoid running destructors, ensure the KickNotifier destructor is run.).

Note
Will be run in a separate thread from the thread that constructed the KickNotifier object. If you need to access DRAMA, take the lock (you probably and to use a drama::AccessDrama object to do this to get the context right).
If this method throws an exception then the thread dies. See class level notes for details of what happens if this occurs. But it is strongly recommended that sub-class implementations don't throw.
Returns
Return true to indicate we should wait for another kick. Return false to indicate the notifier thread should complete, normally this means the blocked code has been unblocked.
Parameters
argArgument to the kick, if any.