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_QUEUE_H_
00024 #define XDISPATCH_QUEUE_H_
00025
00031 #ifndef __XDISPATCH_INDIRECT__
00032 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00033 #endif
00034
00035 #include <iostream>
00036
00037 __XDISPATCH_BEGIN_NAMESPACE
00038
00050 class XDISPATCH_EXPORT queue : public object {
00051
00052 public:
00057 queue(dispatch_queue_t);
00062 queue(const char* label);
00063 queue(const std::string&);
00064 queue(const queue&);
00065 ~queue();
00066
00077 void async(operation*);
00078 #ifdef XDISPATCH_HAS_BLOCKS
00079
00085 inline void async(dispatch_block_t b) {
00086 async( new block_operation(b) );
00087 }
00088 #endif
00089
00101 void apply(iteration_operation*, size_t times);
00102 #ifdef XDISPATCH_HAS_BLOCKS
00103
00111 inline void apply(dispatch_iteration_block_t b, size_t times) {
00112 apply( new block_iteration_operation(b), times );
00113 }
00114 #endif
00115
00126 void after(operation*, struct tm* time);
00127 void after(operation*, dispatch_time_t time);
00128 #ifdef XDISPATCH_HAS_BLOCKS
00129
00134 inline void after(dispatch_block_t b, struct tm* time) {
00135 after( new block_operation(b), time );
00136 }
00137 inline void after(dispatch_block_t b, dispatch_time_t time) {
00138 after( new block_operation(b), time );
00139 }
00140 #endif
00141
00149 void sync(operation*);
00150 #ifdef XDISPATCH_HAS_BLOCKS
00151
00156 inline void sync(dispatch_block_t b) {
00157 sync( new block_operation(b) );
00158 }
00159 #endif
00160
00173 void finalizer(operation*, const queue& = global_queue());
00174 #ifdef XDISPATCH_HAS_BLOCKS
00175
00180 inline void finalizer(dispatch_block_t b, const queue& q = global_queue()) {
00181 finalizer( new block_operation(b), q );
00182 }
00183 #endif
00184
00187 const std::string& label() const;
00194 virtual dispatch_object_t native() const;
00201 virtual dispatch_queue_t native_queue() const;
00202
00203 queue& operator= (const queue&);
00204
00205 private:
00206 class data;
00207 pointer<data>::unique d;
00208
00209 };
00210
00211 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const queue*);
00212 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const queue&);
00213
00214 __XDISPATCH_END_NAMESPACE
00215
00218 #endif