亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? qthread.cpp

?? QT 開發(fā)環(huán)境里面一個(gè)很重要的文件
?? CPP
字號(hào):
/******************************************************************************** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://www.trolltech.com/products/qt/opensource.html**** If you are unsure which license is appropriate for your use, please** review the following information:** http://www.trolltech.com/products/qt/licensing.html or contact the** sales department at sales@trolltech.com.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qthread.h"#include "qthreadstorage.h"#include "qmutex.h"#include "qmutexpool_p.h"#include "qreadwritelock.h"#include "qabstracteventdispatcher.h"#include <qeventloop.h>#include <qhash.h>#include "qthread_p.h"/*  QThreadData*/QThreadData::QThreadData(int initialRefCount)    : _ref(initialRefCount), thread(0), quitNow(false), eventDispatcher(0), canWait(true), tls(0){    // fprintf(stderr, "QThreadData %p created\n", this);}QThreadData::~QThreadData(){    Q_ASSERT(_ref == 0);    QThread *t = thread;    thread = 0;    delete t;    for (int i = 0; i < postEventList.size(); ++i) {        const QPostEvent &pe = postEventList.at(i);        if (pe.event) {            --pe.receiver->d_func()->postedEvents;#ifdef QT3_SUPPORT            if (pe.event->type() == QEvent::ChildInserted)                --pe.receiver->d_func()->postedChildInsertedEvents;#endif            pe.event->posted = false;            delete pe.event;        }    }    // fprintf(stderr, "QThreadData %p destroyed\n", this);}QThreadData *QThreadData::get2(QThread *thread){    Q_ASSERT_X(thread != 0, "QThread", "internal error");    return thread->d_func()->data;}void QThreadData::ref(){#ifndef QT_NO_THREAD    (void) _ref.ref();    Q_ASSERT(_ref != 0);#endif}void QThreadData::deref(){#ifndef QT_NO_THREAD    if (!_ref.deref())        delete this;#endif}#ifndef QT_NO_THREAD/*  QThreadPrivate*/QThreadPrivate::QThreadPrivate(QThreadData *d)    : QObjectPrivate(), running(false), finished(false), terminated(false),      stackSize(0), priority(QThread::InheritPriority), data(d){#if defined (Q_OS_UNIX)    thread_id = 0;#elif defined (Q_WS_WIN)    handle = 0;    id = 0;    waiters = 0;    terminationEnabled = true;    terminatePending = false;#endif    if (!data)        data = new QThreadData;}QThreadPrivate::~QThreadPrivate(){    data->deref();}/*  QAdoptedThread*/QAdoptedThread::QAdoptedThread(QThreadData *data)    : QThread(*new QThreadPrivate(data)){    // thread should be running and not finished for the lifetime    // of the application (even if QCoreApplication goes away)    d_func()->running = true;    d_func()->finished = false;    init();    // fprintf(stderr, "new QAdoptedThread = %p\n", this);}QAdoptedThread::~QAdoptedThread(){    QThreadPrivate::finish(this);    // fprintf(stderr, "~QAdoptedThread = %p\n", this);}QThread *QAdoptedThread::createThreadForAdoption(){    QThread *t = new QAdoptedThread(0);    t->moveToThread(t);    return t;}/*!    \class QThread    \brief The QThread class provides platform-independent threads.    \ingroup thread    \ingroup environment    \mainclass    A QThread represents a separate thread of control within the    program; it shares data with all the other threads within the    process but executes independently in the way that a separate    program does on a multitasking operating system. Instead of    starting in \c main(), QThreads begin executing in run().    To create your own threads, subclass QThread and reimplement    run(). For example:    \code        class MyThread : public QThread        {        public:            void run();        };        void MyThread::run()        {            QTcpSocket socket;            // connect QTcpSocket's signals somewhere meaningful            ...            socket.connectToHost(hostName, portNumber);            exec();        }    \endcode    This will create a QTcpSocket in the thread and then execute the    thread's event loop. Use the start() method to begin execution.    Execution ends when you return from run(), just as an application    does when it leaves main(). QThread will notifiy you via a signal    when the thread is started(), finished(), and terminated(), or    you can use isFinished() and isRunning() to query the state of    the thread. Use wait() to block until the thread has finished    execution.    Each thread gets its own stack from the operating system. The    operating system also determines the default size of the stack.    You can use setStackSize() to set a custom stack size.    Each QThread can have its own event loop. You can start the event    loop by calling exec(); you can stop it by calling exit() or    quit(). Having an event loop in a thread makes it possible to    connect signals from other threads to slots in this threads,    using a mechanism called \l{Qt::QueuedConnection}{queued    connections}. It also makes it possible to use classes that    require the event loop, such as QTimer and QTcpSocket, in the    thread.    In extreme cases, you may want to forcibly terminate() an    executing thread. However, doing so is dangerous and discouraged.    Please read the documentation for terminate() and    setTerminationEnabled() for detailed information.    The static functions currentThreadId() and currentThread() return    identifiers for the currently executing thread. The former    returns a platform specific ID for the thread; the latter returns    a QThread pointer.    QThread also provides platform independent sleep functions in    varying resolutions. Use sleep() for full second resolution,    msleep() for millisecond resolution, and usleep() for microsecond    resolution.    \sa {Thread Support in Qt}, QThreadStorage, QMutex, QSemaphore, QWaitCondition,        {Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example}*//*!    \fn void QThread::started()    This signal is emitted when the thread starts executing.    \sa finished(), terminated()*//*!    \fn void QThread::finished()    This signal is emitted when the thread has finished executing.    \sa started(), terminated()*//*!    \fn void QThread::terminated()    This signal is emitted when the thread is terminated.    \sa started(), finished()*//*!    \enum QThread::Priority    This enum type indicates how the operating system should schedule    newly created threads.    \value IdlePriority scheduled only when no other threads are           running.    \value LowestPriority scheduled less often than LowPriority.    \value LowPriority scheduled less often than NormalPriority.    \value NormalPriority the default priority of the operating           system.    \value HighPriority scheduled more often than NormalPriority.    \value HighestPriority scheduled more often than HighPriority.    \value TimeCriticalPriority scheduled as often as possible.    \value InheritPriority use the same priority as the creating           thread. This is the default.*//*!    Returns a pointer to a QThread which represents the currently    executing thread.*/QThread *QThread::currentThread(){    QThreadData *data = QThreadData::current();    Q_ASSERT(data != 0);    return data->thread;}/*!    Constructs a new thread with the given \a parent. The thread does    not begin executing until start() is called.    \sa start()*/QThread::QThread(QObject *parent)    : QObject(*(new QThreadPrivate), parent){    Q_D(QThread);    // fprintf(stderr, "QThreadData %p created for thread %p\n", d->data, this);    d->data->thread = this;}/*! \internal */QThread::QThread(QThreadPrivate &dd, QObject *parent)    : QObject(dd, parent){    Q_D(QThread);    // fprintf(stderr, "QThreadData %p taken from private data for thread %p\n", d->data, this);    d->data->thread = this;}/*!    Destroys the thread.    Note that deleting a QThread object will not stop the execution    of the thread it represents. Deleting a running QThread (i.e.    isFinished() returns false) will probably result in a program    crash. You can wait() on a thread to make sure that it has    finished.*/QThread::~QThread(){    Q_D(QThread);    {        QMutexLocker locker(&d->mutex);        if (d->running && !d->finished)            qWarning("QThread: Destroyed while thread is still running");        d->data->thread = 0;    }}/*!    Returns true is the thread is finished; otherwise returns false.    \sa isRunning()*/bool QThread::isFinished() const{    Q_D(const QThread);    QMutexLocker locker(&d->mutex);    return d->finished;}/*!    Returns true if the thread is running; otherwise returns false.    \sa isFinished()*/bool QThread::isRunning() const{    Q_D(const QThread);    QMutexLocker locker(&d->mutex);    return d->running;}/*!    Sets the maximum stack size for the thread to \a stackSize. If \a    stackSize is greater than zero, the maximum stack size is set to    \a stackSize bytes, otherwise the maximum stack size is    automatically determined by the operating system.    \warning Most operating systems place minimum and maximum limits    on thread stack sizes. The thread will fail to start if the stack    size is outside these limits.    \sa stackSize()*/void QThread::setStackSize(uint stackSize){    Q_D(QThread);    QMutexLocker locker(&d->mutex);    Q_ASSERT_X(!d->running, "QThread::setStackSize",               "cannot change stack size while the thread is running");    d->stackSize = stackSize;}/*!    Returns the maximum stack size for the thread (if set with    setStackSize()); otherwise returns zero.    \sa setStackSize()*/uint QThread::stackSize() const{    Q_D(const QThread);    QMutexLocker locker(&d->mutex);    return d->stackSize;}/*!    Enters the event loop and waits until exit() is called or the main    widget is destroyed, and returns the value that was set to exit()    (which is 0 if exit() is called via quit()).    It is necessary to call this function to start event handling.    \sa quit(), exit()*/int QThread::exec(){    Q_D(QThread);    d->mutex.lock();    QEventLoop eventLoop;    d->mutex.unlock();    int returnCode = eventLoop.exec();    return returnCode;}/*!    Tells the thread's event loop to exit with a return code.    After calling this function, the thread leaves the event loop and    returns from the call to QEventLoop::exec(). The    QEventLoop::exec() function returns \a returnCode.    By convention, a \a returnCode of 0 means success, any non-zero value    indicates an error.    Note that unlike the C library function of the same name, this    function \e does return to the caller -- it is event processing    that stops.    This function does nothing if the thread does not have an event    loop.    \sa quit() QEventLoop*/void QThread::exit(int returnCode){    Q_D(QThread);    QMutexLocker locker(&d->mutex);    d->data->quitNow = true;    for (int i = 0; i < d->data->eventLoops.size(); ++i) {        QEventLoop *eventLoop = d->data->eventLoops.at(i);        eventLoop->exit(returnCode);    }}/*!    Tells the thread's event loop to exit with return code 0 (success).    Equivalent to calling QThread::exit(0).    This function does nothing if the thread does not have an event    loop.    \sa exit() QEventLoop*/void QThread::quit(){ exit(); }/*!    \fn void QThread::run()    This method is pure virtual and must be implemented in derived    classes in order to do useful work. Returning from this method    will end the execution of the thread.    \sa wait()*//*! \internal    Initializes the QThread system.*/void QThread::initialize(){    if (qt_global_mutexpool)        return;    qt_global_mutexpool = new QMutexPool(true);#if defined (Q_OS_WIN)    extern void qt_create_tls();    qt_create_tls();#endif}/*! \internal    Cleans up the QThread system.*/void QThread::cleanup(){    delete qt_global_mutexpool;    qt_global_mutexpool = 0;}/*!    \fn bool QThread::finished() const    Use isFinished() instead.*//*!    \fn bool QThread::running() const    Use isRunning() instead.*//*! \fn void QThread::setPriority(Priority priority)    \since 4.1    This function sets the \a priority for a running thread. If the    thread is not running, this function does nothing and returns    immediately.  Use start() to start a thread with a specific    priority.    The \a priority argument can be any value in the \c    QThread::Priority enum except for \c InheritPriorty.    \sa Priority priority() start()*//*!    \since 4.1    Returns the priority for a running thread.  If the thread is not    running, this function returns \c InheritPriority.    \sa Priority setPriority() start()*/QThread::Priority QThread::priority() const{    Q_D(const QThread);    QMutexLocker locker(&d->mutex);    return d->priority;}#else // QT_NO_THREAD#include <private/qcoreapplication_p.h>QThread* QThread::instance = 0;QThread::QThread() : QObject(*new QThreadPrivate, (QObject*)0){    Q_D(QThread);    d->data->thread = this;    QCoreApplicationPrivate::theMainThread = this;}QThreadData* QThreadData::current(){    if (QThread::instance)        return QThread::instance->d_func()->data;    return 0;}#endif // QT_NO_THREAD

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲欧洲997久久综合 | 91激情在线视频| 亚洲国产欧美日韩另类综合 | 欧美日韩成人一区| 成人动漫一区二区在线| 午夜精品久久久久久久久久久| 国产欧美一区二区精品性色超碰| 欧美日韩国产首页在线观看| 国产精品69毛片高清亚洲| 亚洲精品乱码久久久久久日本蜜臀| 26uuu亚洲综合色| 精品视频在线视频| 成人午夜视频在线| 久久av资源网| 日本成人在线一区| 亚洲一区日韩精品中文字幕| 国产精品第四页| 久久亚洲免费视频| 欧美一级在线观看| 欧美视频在线不卡| 91传媒视频在线播放| 国产.欧美.日韩| 国产福利视频一区二区三区| 久久国产精品露脸对白| 午夜激情久久久| 亚洲精品视频在线观看网站| 国产精品天干天干在观线| xnxx国产精品| 精品欧美久久久| 欧美一区二区三区免费| 欧美日韩国产中文| 欧美日韩高清一区二区| 色婷婷av一区二区三区gif| www.日韩av| 波多野结衣亚洲一区| 成人黄色免费短视频| 丰满少妇久久久久久久| 丁香婷婷综合色啪| 懂色av噜噜一区二区三区av| 国产精品一二一区| 国产精品自在在线| 国产麻豆成人传媒免费观看| 寂寞少妇一区二区三区| 国产揄拍国内精品对白| 国产一区二区伦理| 成人综合激情网| 丰满白嫩尤物一区二区| 99这里都是精品| 91在线播放网址| 91美女片黄在线| 色国产精品一区在线观看| 色悠久久久久综合欧美99| 日本道色综合久久| 欧美日韩精品三区| 91精品婷婷国产综合久久| 精品免费一区二区三区| 久久久综合网站| 国产精品日日摸夜夜摸av| 中文字幕一区二区三区蜜月| 一区二区三区四区视频精品免费| 亚洲香肠在线观看| 免费成人av在线| 国产综合色在线| 99久久久精品免费观看国产蜜| 欧洲国内综合视频| 欧美一区二区在线播放| 久久日一线二线三线suv| 中文字幕免费在线观看视频一区| 亚洲三级久久久| 日本成人中文字幕在线视频| 国产成人啪免费观看软件| 91丨porny丨在线| 欧美一二三四区在线| 国产欧美日韩三级| 一区二区三区 在线观看视频| 日本中文字幕不卡| 国产精品888| 欧美日韩在线播放三区| 欧美成人三级电影在线| 最新不卡av在线| 日韩国产一区二| 大桥未久av一区二区三区中文| 欧美亚洲高清一区二区三区不卡| 日韩欧美在线网站| 亚洲免费高清视频在线| 久久国产欧美日韩精品| 色丁香久综合在线久综合在线观看| 日韩视频免费直播| 亚洲久本草在线中文字幕| 麻豆精品新av中文字幕| 色综合天天视频在线观看| 日韩精品专区在线| 亚洲精品国产一区二区精华液| 日本色综合中文字幕| www.成人在线| 精品国产一区久久| 亚洲精品va在线观看| 国产乱一区二区| 欧美日韩精品专区| 国产精品视频一二三区| 久久精品理论片| 精品视频一区 二区 三区| 国产精品丝袜一区| 激情图片小说一区| 4hu四虎永久在线影院成人| 最新高清无码专区| 国产成人免费xxxxxxxx| 这里是久久伊人| 亚洲精品国久久99热| 成人中文字幕在线| 337p日本欧洲亚洲大胆精品| 偷拍一区二区三区四区| 色综合久久天天| 久久精品日产第一区二区三区高清版| 午夜亚洲国产au精品一区二区| 91片在线免费观看| 欧美国产国产综合| 国产精品99精品久久免费| 日韩一二三区视频| 偷拍一区二区三区四区| 欧洲精品在线观看| 夜夜嗨av一区二区三区中文字幕| av激情综合网| 国产精品蜜臀av| 成人国产精品视频| 中文字幕第一区综合| 国产盗摄视频一区二区三区| 欧美成人性福生活免费看| 免费精品视频在线| 91精品国产综合久久精品麻豆| 一区二区三区欧美视频| 91免费版在线| 亚洲少妇30p| 91在线免费播放| 亚洲日本一区二区| 94-欧美-setu| 亚洲婷婷在线视频| 在线观看一区二区精品视频| 亚洲精品视频在线看| 色呦呦日韩精品| 一级精品视频在线观看宜春院| 欧美综合天天夜夜久久| 一区二区三区美女视频| 欧美在线你懂得| 五月婷婷久久综合| 欧美一区二区精品久久911| 免费在线观看不卡| xnxx国产精品| 粉嫩高潮美女一区二区三区| 中文字幕一区二区三区乱码在线| 不卡的看片网站| 亚洲免费观看高清完整版在线观看 | 国产精品久久久久久久久免费桃花| 国产99久久精品| 自拍偷拍亚洲欧美日韩| 色中色一区二区| 青青草精品视频| 国产校园另类小说区| 99视频一区二区| 亚洲美女在线一区| 欧美一级国产精品| 国产一区二区91| 亚洲欧洲一区二区三区| 欧美视频第二页| 麻豆精品久久精品色综合| 久久久影院官网| 日本精品一级二级| 免费精品视频在线| 国产精品午夜春色av| 欧美日韩视频一区二区| 久久国产尿小便嘘嘘| 国产精品久久久一本精品 | www.日本不卡| 天涯成人国产亚洲精品一区av| 久久综合中文字幕| 色综合久久中文综合久久97| 蜜臀va亚洲va欧美va天堂| 日本一区二区三区dvd视频在线| 欧美影视一区在线| 国产一区二区三区在线观看免费视频| 亚洲图片你懂的| 日韩午夜小视频| 色综合色综合色综合色综合色综合| 日本在线播放一区二区三区| 中文字幕av一区二区三区高 | 一区二区激情小说| 26uuu国产电影一区二区| 91国产丝袜在线播放| 久久99精品一区二区三区三区| 亚洲人成人一区二区在线观看| 日韩一区二区精品在线观看| 成人av免费观看| 麻豆精品国产91久久久久久| 亚洲欧美日韩一区二区三区在线观看 | 国产一区999| 亚洲成人一区在线| 一区二区中文字幕在线| 精品国产一区久久| 4438x亚洲最大成人网| 成人av午夜电影|