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 #ifdef 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
00110 void sync(QRunnable*);
00111 using xdispatch::queue::sync;
00122 void setFinalizer(QRunnable*, const xdispatch::queue& = xdispatch::global_queue());
00123 void setFinalizer(xdispatch::operation*, const xdispatch::queue& = xdispatch::global_queue());
00124 #ifdef XDISPATCH_HAS_BLOCKS
00125 inline void setFinalizer(dispatch_block_t b, const xdispatch::queue& q = xdispatch::global_queue()) {
00126 setFinalizer( new QBlockRunnable(b), q );
00127 }
00128 #endif
00129
00135 void setTarget(const xdispatch::queue&);
00136
00137 QDispatchQueue& operator=(const QDispatchQueue&);
00138
00139 public slots:
00140 void suspend();
00141 void resume();
00142
00143 };
00144
00145 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue* q);
00146 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue& q);
00147
00148 QT_END_NAMESPACE
00149 QT_END_HEADER
00150
00153 #endif