00001 /* 00002 * Copyright (c) 2011 MLBA. All rights reserved. 00003 * 00004 * @MLBA_OPEN_LICENSE_HEADER_START@ 00005 * 00006 * Licensed under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 * 00018 * @MLBA_OPEN_LICENSE_HEADER_END@ 00019 */ 00020 00021 00022 00023 #ifndef QDISPATCH_QUEUE 00024 #define QDISPATCH_QUEUE 00025 00026 #include "../xdispatch/dispatch.h" 00027 00028 #include "qdispatchglobal.h" 00029 class QTime; 00030 class QRunnable; 00031 class QIterationRunnable; 00032 00033 QT_BEGIN_HEADER 00034 QT_BEGIN_NAMESPACE 00035 00036 QT_MODULE(Dispatch) 00037 00038 00049 class Q_DISPATCH_EXPORT QDispatchQueue : public xdispatch::queue { 00050 00051 public: 00052 QDispatchQueue(const QString& label); 00053 QDispatchQueue(const char*); 00054 QDispatchQueue(dispatch_queue_t); 00055 QDispatchQueue(const xdispatch::queue&); 00056 QDispatchQueue(const QDispatchQueue&); 00057 ~QDispatchQueue(); 00058 00063 virtual void async(QRunnable*); 00064 using xdispatch::queue::async; 00075 virtual void apply(QIterationRunnable*, int times); 00076 using xdispatch::queue::apply; 00083 virtual void after(QRunnable*, const QTime& time); 00084 virtual void after(QRunnable*, dispatch_time_t time); 00085 using xdispatch::queue::after; 00086 #ifdef XDISPATCH_HAS_BLOCKS 00087 00092 virtual void after(dispatch_block_t, const QTime& time); 00093 #endif 00094 00099 virtual void sync(QRunnable*); 00100 using xdispatch::queue::sync; 00111 virtual void set_finalizer(QRunnable*, const xdispatch::queue& = xdispatch::global_queue()); 00112 using xdispatch::queue::set_finalizer; 00113 }; 00114 00115 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue* q); 00116 Q_DECL_EXPORT QDebug operator<<(QDebug dbg, const QDispatchQueue& q); 00117 00118 QT_END_NAMESPACE 00119 QT_END_HEADER 00120 00121 #endif /* QDISPATCH_QUEUE */