Provides a timer executing a block or an operation on a specific queue when a timeout occurs. More...
Public Member Functions | |
timer (uint64_t interval, const xdispatch::queue &target=global_queue(), dispatch_time_t starting=DISPATCH_TIME_NOW) | |
Constructs a new periodic timer. | |
timer (const timer &) | |
timer (dispatch_source_t) | |
~timer () | |
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 | start () |
Will start the timer. | |
void | resume () |
void | stop () |
Will stop the timer. | |
void | suspend () |
void | handler (xdispatch::operation *) |
Sets the operation that will be executed every time the timer fires. | |
void | handler (dispatch_block_t) |
Sets the block that will be executed every time the timer fires. | |
void | target_queue (const xdispatch::queue &) |
Sets the queue the handler will be executed on. | |
xdispatch::queue | target_queue () |
dispatch_object_t | native () const |
timer & | operator= (const timer &) |
Static Public Member Functions | |
static timer * | current () |
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, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. | |
static void | single_shot (struct tm *, const xdispatch::queue &, dispatch_block_t) |
Creates a single shot timer executing the given block on the given queue at the given time. |
Provides a timer executing a block or an operation on a specific queue when a timeout occurs.
xdispatch::timer::timer | ( | uint64_t | interval, |
const xdispatch::queue & | target = global_queue() , |
||
dispatch_time_t | starting = DISPATCH_TIME_NOW |
||
) |
Constructs a new periodic timer.
The timer will be stopped, call start() to execute it
interval | The interval in nanoseconds at which the timer will fire after the timeout occured. |
target | The queue to execute the timer on, defaults to the global_queue |
starting | The time at which the timer will fire for the first time |
xdispatch::timer::timer | ( | const timer & | ) |
xdispatch::timer::timer | ( | dispatch_source_t | ) |
xdispatch::timer::~timer | ( | ) |
static timer* xdispatch::timer::current | ( | ) | [static] |
Reimplemented in QDispatchTimer.
void xdispatch::timer::handler | ( | dispatch_block_t | ) |
Sets the block that will be executed every time the timer fires.
void xdispatch::timer::handler | ( | xdispatch::operation * | ) |
Sets the operation that will be executed every time the timer fires.
As in queues, the timer takes possesion of the operation and will handle deletion. To change this behaviour, set the auto_delete flag of the operation.
void xdispatch::timer::interval | ( | uint64_t | ) |
Use this to set the interval in nanoseconds.
When called for the first time on a single-shot timer, the timer will be converted to a periodic timer with the given interval.
void xdispatch::timer::latency | ( | uint64_t | ) |
Use this to set the latency in nanoseconds which the timer might be early or late.
When not set the latency will be kept as low as possible.
dispatch_object_t xdispatch::timer::native | ( | ) | const [virtual] |
Implements xdispatch::object.
void xdispatch::timer::resume | ( | ) | [virtual] |
Implements xdispatch::object.
static void xdispatch::timer::single_shot | ( | dispatch_time_t | , |
const xdispatch::queue & | , | ||
xdispatch::operation * | |||
) | [static] |
Creates a single shot timer executing the given operation on the given queue at the given time.
This is quite similar to using xdispatch::queue::after()
static void xdispatch::timer::single_shot | ( | dispatch_time_t | , |
const xdispatch::queue & | , | ||
dispatch_block_t | |||
) | [static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using xdispatch::queue::after()
static void xdispatch::timer::single_shot | ( | struct tm * | , |
const xdispatch::queue & | , | ||
dispatch_block_t | |||
) | [static] |
Creates a single shot timer executing the given block on the given queue at the given time.
This is quite similar to using xdispatch::queue::after()
static void xdispatch::timer::single_shot | ( | struct tm * | , |
const xdispatch::queue & | , | ||
xdispatch::operation * | |||
) | [static] |
Creates a single shot timer executing the given operation on the given queue at the given time.
This is quite similar to using xdispatch::queue::after()
void xdispatch::timer::start | ( | ) |
Will start the timer.
Reimplemented in QDispatchTimer.
void xdispatch::timer::stop | ( | ) |
Will stop the timer.
Reimplemented in QDispatchTimer.
void xdispatch::timer::suspend | ( | ) | [virtual] |
Implements xdispatch::object.
void xdispatch::timer::target_queue | ( | const xdispatch::queue & | ) |
Sets the queue the handler will be executed on.
xdispatch::queue xdispatch::timer::target_queue | ( | ) |