Provides a timer executing a block or runnable each time it fires on a given queue. More...
#include <QtDispatch/qdispatchtimer.h>
Public Slots | |
void | start () |
Starts the timer. | |
void | stop () |
Stops the timer. | |
Public Member Functions | |
QDispatchTimer (int msec, QObject *parent=NULL) | |
Constructs a new timer firing every msec milliseconds. | |
QDispatchTimer (const QDispatchTimer &) | |
QDispatchTimer (const xdispatch::timer &, QObject *parent=NULL) | |
~QDispatchTimer () | |
void | setInterval (int msec) |
Changes the interval of the timer to msec. | |
void | setTargetQueue (const xdispatch::queue &) |
Sets the queue the timer will execute on. | |
void | setHandler (QRunnable *) |
Sets the runnable that will be executed every time the timer fires. | |
void | setHandler (dispatch_block_t b) |
Sets a block that will be executed every time the timer fires. | |
void | setLatency (int usec) |
Sets the latency, i.e. | |
bool | operator== (const QDispatchTimer &) |
Static Public Member Functions | |
static void | singleShot (dispatch_time_t, const xdispatch::queue &, QRunnable *) |
Creates a single shot timer executing the given runnable on the given queue at the given time. | |
static void | singleShot (const QTime &, const xdispatch::queue &, QRunnable *) |
Creates a single shot timer executing the given runnable on the given queue at the given time. | |
static void | singleShot (dispatch_time_t t, const xdispatch::queue &q, dispatch_block_t b) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static void | singleShot (const QTime &t, const xdispatch::queue &q, dispatch_block_t b) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static QDispatchTimer * | current () |
Private Member Functions | |
void | interval (uint64_t) |
Use this to set the interval in nanoseconds. | |
void | latency (uint64_t) |
Use this to set the latency in nanoseconds which the timer might be early or late. | |
void | resume () |
Resumes the invocation of operations or blocks assigned to the object. | |
void | suspend () |
Suspends the invocation of operations or blocks assigned to the object. | |
void | handler (xdispatch::operation *) |
Sets the handler to dispatch each time the source becomes ready. | |
virtual void | handler (dispatch_block_t b) |
Sets the handler to dispatch each time the source becomes ready. | |
void | target_queue (const xdispatch::queue &) |
Sets the queue the handler will be executed on. | |
xdispatch::queue | target_queue () const |
virtual dispatch_object_t | native () const |
dispatch_source_t | native_source () const |
void | cancel () |
Asynchronously cancels the dispatch source, preventing any further invocation of its event handler block. | |
void | cancel_handler (xdispatch::operation *) |
Sets the cancellation handler block for the given dispatch source. | |
virtual void | cancel_handler (dispatch_block_t b) |
Sets the cancellation handler block for the given dispatch source. | |
bool | operator== (const object &) |
bool | operator== (const dispatch_object_t &) |
bool | operator!= (const object &) |
bool | operator!= (const dispatch_object_t &) |
Static Private Member Functions | |
static void | single_shot (dispatch_time_t, const xdispatch::queue &, xdispatch::operation *) |
Creates a single shot timer executing the given operation on the given queue at the given time. | |
static void | single_shot (struct tm *, const xdispatch::queue &, xdispatch::operation *) |
Creates a single shot timer executing the given operation on the given queue at the given time. | |
static void | single_shot (dispatch_time_t t, const xdispatch::queue &q, dispatch_block_t b) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static void | single_shot (struct tm *t, const xdispatch::queue &q, dispatch_block_t b) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
template<typename T > | |
static T | data () |
Provides a timer executing a block or runnable each time it fires on a given queue.
The default queue for dispatch timers is the global queue.
The timer may have a divergence from the exact interval, the allowed size of this divergence can be influenced by using setLatency().
Definition at line 52 of file qdispatchtimer.h.
QDispatchTimer::QDispatchTimer | ( | int | msec, |
QObject * | parent = NULL |
||
) |
Constructs a new timer firing every msec milliseconds.
The timer will be constructed in a stopped state, use start() to launch it.
QDispatchTimer::QDispatchTimer | ( | const QDispatchTimer & | ) |
QDispatchTimer::QDispatchTimer | ( | const xdispatch::timer & | , |
QObject * | parent = NULL |
||
) |
static QDispatchTimer* QDispatchTimer::current | ( | ) | [static] |
Reimplemented from xdispatch::timer.
bool QDispatchTimer::operator== | ( | const QDispatchTimer & | ) |
void QDispatchTimer::setHandler | ( | QRunnable * | ) |
Sets the runnable that will be executed every time the timer fires.
void QDispatchTimer::setHandler | ( | dispatch_block_t | b | ) | [inline] |
Sets a block that will be executed every time the timer fires.
Definition at line 86 of file qdispatchtimer.h.
void QDispatchTimer::setInterval | ( | int | msec | ) |
Changes the interval of the timer to msec.
void QDispatchTimer::setLatency | ( | int | usec | ) |
Sets the latency, i.e.
the divergence the timer may have. Please note that this can only be regarded as a hint and is not garuanted to be followed strictly.
void QDispatchTimer::setTargetQueue | ( | const xdispatch::queue & | ) |
Sets the queue the timer will execute on.
static void QDispatchTimer::singleShot | ( | dispatch_time_t | , |
const xdispatch::queue & | , | ||
QRunnable * | |||
) | [static] |
Creates a single shot timer executing the given runnable on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
static void QDispatchTimer::singleShot | ( | const QTime & | , |
const xdispatch::queue & | , | ||
QRunnable * | |||
) | [static] |
Creates a single shot timer executing the given runnable on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
static void QDispatchTimer::singleShot | ( | dispatch_time_t | t, |
const xdispatch::queue & | q, | ||
dispatch_block_t | b | ||
) | [inline, static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
Definition at line 112 of file qdispatchtimer.h.
static void QDispatchTimer::singleShot | ( | const QTime & | t, |
const xdispatch::queue & | q, | ||
dispatch_block_t | b | ||
) | [inline, static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using QDispatchQueue::after()
Definition at line 119 of file qdispatchtimer.h.
void QDispatchTimer::start | ( | ) | [slot] |
void QDispatchTimer::stop | ( | ) | [slot] |
Stops the timer.
Reimplemented from xdispatch::timer.