#include <timer.h>
Signals | |
void | timeout (bool failed) |
Signaled when the timer expires. | |
Public Member Functions | |
Timer (TimerHostState *host, QObject *parent=NULL) | |
Create a timer. | |
bool | isActive () const |
Determine if the timer is currently active. | |
qint64 | interval () const |
void | start (qint64 initperiod=retryMin, qint64 failperiod=failMax) |
Start or restart the timer at a specified or default interval. | |
void | stop () |
Stop the timer if it is currently running. | |
void | restart () |
Restart the timer with a longer interval after a retry. | |
bool | failed () |
Determine if we've reached the hard failure deadline. | |
Static Public Member Functions | |
qint64 | backoff (qint64 period, qint64 maxperiod=failMax) |
Exponential backoff function for retry. | |
Static Public Attributes | |
const qint64 | retryMin = 500*1000 |
Default initial retry time: 500 ms. | |
const qint64 | retryMax = 60*1000*1000 |
Default max retry period: 1 minute. | |
const qint64 | failMax = 20*1000*1000 |
Default hard failure deadline: 20 seconds. | |
Friends | |
class | TimerEngine |
Supports exponential backoff computations for retransmissions and retries, as well as an optional "hard" failure deadline. Also can be hooked and virtualized for simulation purposes.
|
Create a timer.
|
|
Determine if we've reached the hard failure deadline.
|
|
Determine if the timer is currently active.
|
|
Start or restart the timer at a specified or default interval.
|
|
Signaled when the timer expires.
|