本文整理汇总了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(); \
} \
示例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(); \
} \
示例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;
}
示例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());
}
示例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
}