Give a task a maximum amount of time to complete. More...
#include <TaskTimer.hh>
Public Types | |
typedef boost::shared_ptr< char > | name_type |
typedef boost::shared_ptr< char > | name_type |
typedef Thread::cancel_type | cancel_method |
typedef Thread::cancel_type | cancel_method |
typedef Thread::signal_type | signal_type |
Data class for passing signal information. | |
typedef Thread::signal_type | signal_type |
Data class for passing signal information. | |
Public Member Functions | |
Timer (int Seconds, signal_type CancelSignal=SignalHandler::SIGNAL_UNKNOWN) | |
Constructor. | |
Timer (int Seconds, signal_type CancelSignal=SignalHandler::SIGNAL_UNKNOWN) | |
Constructor. | |
virtual void | operator() () |
Action. | |
virtual void | operator() () |
Action. | |
bool | Error () const |
True if time ran out for the process to complete. | |
bool | Error () const |
True if time ran out for the process to complete. | |
MutexLock::baton_type | Baton () const |
Retrieve baton to gain exclusive access. | |
MutexLock::baton_type | Baton () const |
Retrieve baton to gain exclusive access. | |
cancel_method | CancelMethod () const |
Retrieve method to use for terminating the task. | |
cancel_method | CancelMethod () const |
Retrieve method to use for terminating the task. | |
signal_type | CancelSignal () const |
Retrieve signal to use for terminating the task. | |
signal_type | CancelSignal () const |
Retrieve signal to use for terminating the task. | |
bool | DeleteOnCompletion () const |
Retrieve state information concearning deletion. | |
bool | DeleteOnCompletion () const |
Retrieve state information concearning deletion. | |
virtual void | OnCompletion (int TaskThreadState) |
Action to be done when task completes. | |
virtual void | OnCompletion (int TaskThreadState) |
Action to be done when task completes. | |
name_type | TaskName () const |
Get the name of the current task. | |
name_type | TaskName () const |
Get the name of the current task. | |
Protected Member Functions | |
void | taskName (const std::string &Name) |
void | taskName (const std::string &Name) |
void | delete_on_completion (bool Value) |
void | delete_on_completion (bool Value) |
Private Attributes | |
int | m_timeout |
bool | m_err |
name_type | name |
std::unique_ptr< _p_type > | _p |
Give a task a maximum amount of time to complete.
This class ensures that a task completes within a given amount of time. If the task does not complete, the it is canceled using the registered cancellation signal.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Data class for passing signal information.
|
inherited |
Data class for passing signal information.
LDASTools::AL::Timer::Timer | ( | int | Seconds, |
signal_type | CancelSignal = SignalHandler::SIGNAL_UNKNOWN ) |
Constructor.
Initialize the instance of the class.
[in] | Seconds | Number of seconds to allow task to complete |
[in] | CancelSignal | Signal to use to cancel this timer. |
LDASTools::AL::Timer::Timer | ( | int | Seconds, |
signal_type | CancelSignal = SignalHandler::SIGNAL_UNKNOWN ) |
Constructor.
[in] | Seconds | Number of seconds to allow task to complete |
[in] | CancelSignal | Signal to use to cancel this timer. |
|
inherited |
Retrieve baton to gain exclusive access.
|
inherited |
Retrieve baton to gain exclusive access.
|
inherited |
Retrieve method to use for terminating the task.
|
inherited |
Retrieve method to use for terminating the task.
|
inherited |
Retrieve signal to use for terminating the task.
|
inherited |
Retrieve signal to use for terminating the task.
|
protectedinherited |
|
protectedinherited |
|
inherited |
Retrieve state information concearning deletion.
|
inherited |
Retrieve state information concearning deletion.
bool LDASTools::AL::Timer::Error | ( | ) | const |
True if time ran out for the process to complete.
Return true if the timer expired before being cancelled.
bool LDASTools::AL::Timer::Error | ( | ) | const |
True if time ran out for the process to complete.
|
virtualinherited |
Action to be done when task completes.
This function is called regardless of why the task was terminated. It allows for any special cleanup or other action that needs to happen at the end of a task regardless of why the task terminated.
|
virtualinherited |
Action to be done when task completes.
|
virtual |
Action.
For the timer task, the action is to start an interuptable sleep timer for the requested maximum time period. m_err is set to true if the sleep timer completes without any error.
Implements LDASTools::AL::Task.
|
virtual |
Action.
Implements LDASTools::AL::Task.
|
inlineinherited |
Get the name of the current task.
|
inherited |
Get the name of the current task.
|
inlineprotectedinherited |
|
protectedinherited |
|
privateinherited |
|
private |
|
private |
|
privateinherited |