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
00026 #ifndef __XDISPATCH_INDIRECT__
00027 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00028 #endif
00029
00030 #include <memory>
00031
00032 __XDISPATCH_BEGIN_NAMESPACE
00033
00043 class XDISPATCH_EXPORT timer {
00044
00045 public:
00052 timer(uint64_t interval, const xdispatch::queue& target = global_queue());
00053 timer(const timer&);
00054 timer(dispatch_source_t);
00055 ~timer();
00056
00062 void interval(uint64_t);
00068 void latency(uint64_t);
00074 void start();
00080 void stop();
00087 void handler(xdispatch::operation*);
00088 #ifdef XDISPATCH_HAS_BLOCKS
00089
00092 void handler(dispatch_block_t);
00093 #endif
00094
00097 void set_queue(const xdispatch::queue&);
00101 xdispatch::queue queue();
00105 virtual const dispatch_source_t native() const;
00110 static timer* current();
00115 static void single_shot(dispatch_time_t, const xdispatch::queue&, xdispatch::operation*);
00120 static void single_shot(struct tm*, const xdispatch::queue&, xdispatch::operation*);
00121 #ifdef XDISPATCH_HAS_BLOCKS
00122
00126 static void single_shot(dispatch_time_t, const xdispatch::queue&, dispatch_block_t);
00131 static void single_shot(struct tm*, const xdispatch::queue&, dispatch_block_t);
00132 #endif
00133
00134 private:
00135 class data;
00136 data* d;
00137
00138 };
00139
00140 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const timer*);
00141 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream& stream, const timer&);
00142
00143 __XDISPATCH_END_NAMESPACE
00144
00145 #endif