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 QDISPATCH_GROUP_H_
00024 #define QDISPATCH_GROUP_H_
00025 
00026 #include <QtCore/qobject.h>
00027 #include <QtCore/qscopedpointer.h>
00028 
00029 #include "qdispatchglobal.h"
00030 #include "qblockrunnable.h"
00031 
00037 QT_BEGIN_HEADER
00038 QT_BEGIN_NAMESPACE
00039 
00040 class QRunnable;
00041 class QDispatchQueue;
00042 class QTime;
00043 
00044 QT_MODULE(Dispatch)
00045 
00046 
00056 class Q_DISPATCH_EXPORT QDispatchGroup : public QObject, public xdispatch::group {
00057 
00058         Q_OBJECT
00059 
00060     public:
00064         QDispatchGroup();
00065         QDispatchGroup(dispatch_group_t);
00066         QDispatchGroup(const QDispatchGroup&);
00067         QDispatchGroup(const xdispatch::group&);
00068         ~QDispatchGroup();
00069 
00075         void async(QRunnable* r, const xdispatch::queue& q = xdispatch::global_queue());
00076         using xdispatch::group::async;
00083         bool wait(const QTime& t);
00084         using xdispatch::group::wait;
00097         void notify(QRunnable* r, const xdispatch::queue& = xdispatch::global_queue());
00101         void notify(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00102   #if XDISPATCH_HAS_BLOCKS
00103 
00106         inline void notify(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00107             notify( new QBlockRunnable(b), q );
00108         }
00109   #endif
00110   #if XDISPATCH_HAS_FUNCTION
00111 
00114         inline void notify(const xdispatch::lambda_function& b, const xdispatch::queue& q = xdispatch::global_queue()) {
00115             notify( new QLambdaRunnable(b), q );
00116         }
00117   #endif
00118 
00132         void enableAllFinishedSignal();
00133 
00134     public slots:
00135         void resume();
00136         void suspend();
00137 
00138     signals:
00148         void allFinished();
00149 
00150     private:
00151 
00152         class Emitter;
00153         friend class Emitter;
00154         friend Q_DECL_EXPORT QDebug operator<<(QDebug, const QDispatchGroup&);
00155 
00156         class Private;
00157         QScopedPointer<Private> d;
00158 };
00159 
00160 Q_DECL_EXPORT QDebug operator<<(QDebug, const QDispatchGroup&);
00161 
00162 QT_END_NAMESPACE
00163 QT_END_HEADER
00164 
00167 #endif