Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef XDISPATCH_TIMER_H_
00024 #define XDISPATCH_TIMER_H_
00025
00031 #ifndef __XDISPATCH_INDIRECT__
00032 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00033 #endif
00034
00035 __XDISPATCH_BEGIN_NAMESPACE
00036
00046 class XDISPATCH_EXPORT timer : public source {
00047
00048 public:
00056 timer(uint64_t interval, const xdispatch::queue& target = global_queue(), const time& starting = time_now);
00057 timer(const timer&);
00058 ~timer();
00059
00065 void interval(uint64_t);
00071 void latency(uint64_t);
00078 inline void start(){ resume(); }
00085 inline void stop(){ suspend(); }
00090 static timer* current();
00095 static void single_shot(dispatch_time_t, const xdispatch::queue&, xdispatch::operation*);
00100 static void single_shot(struct tm*, const xdispatch::queue&, xdispatch::operation*);
00101 #ifdef XDISPATCH_HAS_BLOCKS
00102
00106 static void single_shot(dispatch_time_t t, const xdispatch::queue& q, dispatch_block_t b) {
00107 single_shot( t, q, new block_operation(b) );
00108 }
00113 static void single_shot(struct tm* t, const xdispatch::queue& q, dispatch_block_t b) {
00114 single_shot( t, q, new block_operation(b) );
00115 }
00116 #endif
00117
00121 static void single_shot(dispatch_time_t t, const xdispatch::queue& q, const lambda_function& b) {
00122 single_shot( t, q, new function_operation(b) );
00123 }
00128 static void single_shot(struct tm* t, const xdispatch::queue& q, const lambda_function& b) {
00129 single_shot( t, q, new function_operation(b) );
00130 }
00131
00132 timer& operator =(const timer&);
00133
00134 };
00135
00136 __XDISPATCH_END_NAMESPACE
00137
00138
00141 #endif