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 #ifndef XDISPATCH_GROUP_H_
00023 #define XDISPATCH_GROUP_H_
00024
00030 #ifndef __XDISPATCH_INDIRECT__
00031 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00032 #endif
00033
00034 #include <iostream>
00035
00036 __XDISPATCH_BEGIN_NAMESPACE
00037
00048 class XDISPATCH_EXPORT group : public object {
00049
00050 public:
00054 group();
00058 group(dispatch_group_t);
00059 group(const group&);
00060 ~group();
00061
00067 void async(operation* r, const queue& q = global_queue());
00068 #if XDISPATCH_HAS_BLOCKS
00069
00073 inline void async(dispatch_block_t b, const queue& q = global_queue()) {
00074 async( new block_operation(b), q );
00075 }
00076 #endif
00077 #if XDISPATCH_HAS_FUNCTION
00078
00082 inline void async(const lambda_function& b, const queue& q = global_queue()) {
00083 async( new function_operation(b), q );
00084 }
00085 #endif
00086
00093 bool wait(dispatch_time_t t = DISPATCH_TIME_FOREVER);
00100 bool wait(struct tm* timeout);
00113 void notify(operation* r, const queue& q = global_queue());
00114 #if XDISPATCH_HAS_BLOCKS
00115
00127 inline void notify(dispatch_block_t b, const queue& q = global_queue()) {
00128 notify( new block_operation(b), q );
00129 }
00130 #endif
00131 #if XDISPATCH_HAS_FUNCTION
00132
00144 inline void notify(const lambda_function& b, const queue& q = global_queue()) {
00145 notify( new function_operation(b), q );
00146 }
00147 #endif
00148
00153 virtual dispatch_object_t native() const;
00159 dispatch_group_t native_group() const;
00160
00161 group& operator=(const group&);
00162
00163 private:
00164 class data;
00165 pointer<data>::unique d;
00166 };
00167
00168 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const group* );
00169 XDISPATCH_EXPORT std::ostream& operator<<(std::ostream&, const group& );
00170
00171 __XDISPATCH_END_NAMESPACE
00172
00175 #endif