当前位置: 首页>>代码示例>>C++>>正文


C++ QBasicAtomicInt::deref方法代码示例

本文整理汇总了C++中QBasicAtomicInt::deref方法的典型用法代码示例。如果您正苦于以下问题:C++ QBasicAtomicInt::deref方法的具体用法?C++ QBasicAtomicInt::deref怎么用?C++ QBasicAtomicInt::deref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QBasicAtomicInt的用法示例。


在下文中一共展示了QBasicAtomicInt::deref方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

 void run()
 {
     while (t.elapsed() < one_minute) {
         mutex.lock();
         if (sentinel.ref()) ++errorCount;
         if (!sentinel.deref()) ++errorCount;
         lockCount.ref();
         mutex.unlock();
         if (mutex.tryLock()) {
             if (sentinel.ref()) ++errorCount;
             if (!sentinel.deref()) ++errorCount;
             lockCount.ref();
             mutex.unlock();
         }
     }
 }
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:16,代码来源:tst_qmutex.cpp

示例2: run

 void run()
 {
     while (t.elapsed() < one_minute) {
         mutex.lock();
         Q_ASSERT(!sentinel.ref());
         Q_ASSERT(sentinel.deref());
         lockCount.ref();
         mutex.unlock();
         if (mutex.tryLock()) {
             Q_ASSERT(!sentinel.ref());
             Q_ASSERT(sentinel.deref());
             lockCount.ref();
             mutex.unlock();
         }
     }
 }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例3: messageHandler

    static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message)
    {
        static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);

        if (QTest::TestLoggers::loggerCount() == 0) {
            // if this goes wrong, something is seriously broken.
            qInstallMessageHandler(oldMessageHandler);
            QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0);
        }

        if (handleIgnoredMessage(type, message))
            // the message is expected, so just swallow it.
            return;

        QString msg = qFormatLogMessage(type, context, message);

        if (type != QtFatalMsg) {
            if (counter.load() <= 0)
                return;

            if (!counter.deref()) {
                QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem,
                        QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override."));
                return;
            }
        }

        switch (type) {
        case QtDebugMsg:
            QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);
            break;
        case QtCriticalMsg:
            QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, msg);
            break;
        case QtWarningMsg:
            QTest::TestLoggers::addMessage(QAbstractTestLogger::QWarning, msg);
            break;
        case QtFatalMsg:
            QTest::TestLoggers::addMessage(QAbstractTestLogger::QFatal, msg);
            /* Right now, we're inside the custom message handler and we're
             * being qt_message_output in qglobal.cpp. After we return from
             * this function, it will proceed with calling exit() and abort()
             * and hence crash. Therefore, we call these logging functions such
             * that we wrap up nicely, and in particular produce well-formed XML. */
            QTestResult::addFailure("Received a fatal error.", "Unknown file", 0);
            QTestLog::leaveTestFunction();
            QTestLog::stopLogging();
            break;
        }
    }
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:50,代码来源:qtestlog.cpp

示例4:

 inline ~SPointer() { count.deref(); }
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:1,代码来源:tst_qthreadstorage.cpp


注:本文中的QBasicAtomicInt::deref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。