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_QUEUE
00024 #define QDISPATCH_QUEUE
00025
00026 #include <QtCore/qobject.h>
00027
00028 #include "qdispatchglobal.h"
00029 #include "qblockrunnable.h"
00030
00036 QT_BEGIN_HEADER
00037 QT_BEGIN_NAMESPACE
00038
00039 class QTime;
00040 class QRunnable;
00041 class QIterationRunnable;
00042
00043 QT_MODULE(Dispatch)
00044
00045
00056 class Q_DISPATCH_EXPORT QDispatchQueue : public QObject, public xdispatch::queue {
00057
00058 Q_OBJECT
00059
00060 public:
00061 QDispatchQueue(const QString& label);
00062 QDispatchQueue(const char*);
00063 QDispatchQueue(dispatch_queue_t);
00064 QDispatchQueue(const xdispatch::queue&);
00065 QDispatchQueue(const QDispatchQueue&);
00066 ~QDispatchQueue();
00067
00072 void async(QRunnable*);
00073 using xdispatch::queue::async;
00084 void apply(QIterationRunnable*, int times);
00085 using xdispatch::queue::apply;
00092 void after(QRunnable*, const QTime& time);
00093 void after(QRunnable*, dispatch_time_t time);
00094 using xdispatch::queue::after;
00095 #if XDISPATCH_HAS_BLOCKS
00096
00101 inline void after(dispatch_block_t b, const QTime& time) {
00102 after( new QBlockRunnable(b), time );
00103 }
00104 #endif
00105 #if XDISPATCH_HAS_FUNCTION
00106
00111 inline void after(const xdispatch::lambda_function& b, const QTime& time) {
00112 after( new QLambdaRunnable(b), time );
00113 }
00114 #endif
00115
00120 void sync(QRunnable*);
00121 using xdispatch::queue::sync;
00132 void setFinalizer(QRunnable*, const xdispatch::queue& = xdispatch::global_queue());
00133 void setFinalizer(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00134 #if XDISPATCH_HAS_BLOCKS
00135 inline void setFinalizer(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00136 setFinalizer( new QBlockRunnable(b), q );
00137 }
00138 #endif
00139 #if XDISPATCH_HAS_FUNCTION
00140 inline void setFinalizer(const xdispatch::lambda_function& b, const xdispatch::queue& q = xdispatch::global_queue()) {
00141 setFinalizer( new QLambdaRunnable(b), q );
00142 }
00143 #endif
00144
00150 void setTarget(const xdispatch::queue&);
00151
00152 QDispatchQueue& operator=(const QDispatchQueue&);
00153
00154 public slots:
00155 void suspend();
00156 void resume();
00157
00158 };
00159
00160 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue* q);
00161 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue& q);
00162
00163 QT_END_NAMESPACE
00164 QT_END_HEADER
00165
00168 #endif