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


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

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


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

示例1: qt_metatype_id

 static int qt_metatype_id() \
 { \
     static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
     if (!metatype_id.load()) \
         metatype_id.store(qRegisterMetaType< QPair<qreal,QColor > >("QPair<qreal,QColor >")); \
     return metatype_id.load(); \
 } \
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:7,代码来源:qtscript_QGradient.cpp

示例2: qt_metatype_id

 static int qt_metatype_id() \
 { \
     static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
     if (!metatype_id.load()) \
         metatype_id.store(qRegisterMetaType< QHash<int,QByteArray > >("QHash<int,QByteArray >")); \
     return metatype_id.load(); \
 } \
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:7,代码来源:qtscriptshell_QStandardItemModel.cpp

示例3: fcntlWorksAfterFlock

/*!
  \internal
  Checks that the OS isn't using POSIX locks to emulate flock().
  OS X is one of those.
*/
static bool fcntlWorksAfterFlock()
{
    int value = fcntlOK.load();
    if (Q_UNLIKELY(value == -1)) {
        value = QLockFilePrivate::checkFcntlWorksAfterFlock();
        fcntlOK.store(value);
    }
    return value == 1;
}
开发者ID:oneywang,项目名称:qtbase,代码行数:14,代码来源:qlockfile_unix.cpp

示例4: openFlags

KConfigPrivate::KConfigPrivate(KConfig::OpenFlags flags,
                               QStandardPaths::StandardLocation resourceType)
    : openFlags(flags), resourceType(resourceType), mBackend(Q_NULLPTR),
      bDynamicBackend(true),  bDirty(false), bReadDefaults(false),
      bFileImmutable(false), bForceGlobal(false), bSuppressGlobal(false),
      configState(KConfigBase::NoAccess)
{
    static QBasicAtomicInt use_etc_kderc = Q_BASIC_ATOMIC_INITIALIZER(-1);
    if (use_etc_kderc.load() < 0) {
        use_etc_kderc.store( !qEnvironmentVariableIsSet("KDE_SKIP_KDERC"));    // for unit tests
    }
    if (use_etc_kderc.load()) {

        etc_kderc =
#ifdef Q_OS_WIN
            QFile::decodeName(qgetenv("WINDIR") + "/kde5rc");
#else
            QStringLiteral("/etc/kde5rc");
#endif
        if (!QFileInfo(etc_kderc).isReadable()) {
            etc_kderc.clear();
        }
    }

//    if (!mappingsRegistered) {
//        KEntryMap tmp;
//        if (!etc_kderc.isEmpty()) {
//            QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(etc_kderc, QLatin1String("INI"));
//            backend->parseConfig( "en_US", tmp, KConfigBackend::ParseDefaults);
//        }
//        const QString kde5rc(QDir::home().filePath(".kde5rc"));
//        if (KStandardDirs::checkAccess(kde5rc, R_OK)) {
//            QExplicitlySharedDataPointer<KConfigBackend> backend = KConfigBackend::create(kde5rc, QLatin1String("INI"));
//            backend->parseConfig( "en_US", tmp, KConfigBackend::ParseOptions());
//        }
//        KConfigBackend::registerMappings(tmp);
//        mappingsRegistered = true;
//    }

    setLocale(QLocale().name());
}
开发者ID:KDE,项目名称:kconfig,代码行数:41,代码来源:kconfig.cpp

示例5: getticks

static qint64 getticks()
{
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
    clockid_t clockId;

#ifndef _POSIX_THREAD_CPUTIME
    clockId = CLOCK_REALTIME;
#elif (_POSIX_THREAD_CPUTIME-0 <= 0)
    // if we don't have CLOCK_THREAD_CPUTIME_ID, we have to just use elapsed realtime instead
    clockId = CLOCK_REALTIME;

#  if (_POSIX_THREAD_CPUTIME-0 == 0)
    // detect availablility of CLOCK_THREAD_CPUTIME_ID
    static QBasicAtomicInt sUseThreadCpuTime = Q_BASIC_ATOMIC_INITIALIZER(-2);
    int useThreadCpuTime = sUseThreadCpuTime.load();
    if (useThreadCpuTime == -2) {
        // sysconf() will return either -1L or _POSIX_VERSION
        // (don't care about sysconf's exact return value)
        useThreadCpuTime = sysconf(_SC_THREAD_CPUTIME) == -1L ? -1 : 0 ;
        sUseThreadCpuTime.store(useThreadCpuTime); // might happen multiple times, but doesn't matter
    }
    if (useThreadCpuTime != -1)
        clockId = CLOCK_THREAD_CPUTIME_ID;
#  endif
#else
    clockId = CLOCK_THREAD_CPUTIME_ID;
#endif

    struct timespec ts;
    if (clock_gettime(clockId, &ts) == -1)
        return 0;
    return (ts.tv_sec * 1000000000) + ts.tv_nsec;
#else

    // no clock_gettime(), fall back to wall time
    struct timeval tv;
    gettimeofday(&tv, 0);
    return (tv.tv_sec * 1000000) + tv.tv_usec;
#endif
}
开发者ID:AlexSoehn,项目名称:qt-base-deb,代码行数:40,代码来源:qtconcurrentiteratekernel.cpp


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