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


C++ QAtomicInt::fetchAndAddAcquire方法代码示例

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


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

示例1:

ULONG		CDeckLinkGLWidget::AddRef ()
{
	int		oldValue;
	
	oldValue = refCount.fetchAndAddAcquire(1);
	return (ULONG)(oldValue + 1);
}
开发者ID:wolfg1969,项目名称:Blackmagic-Decklink-SDK-Archive,代码行数:7,代码来源:SignalGenerator.cpp

示例2: ID_COUNTER

toConnectionSub *toQPSqlConnectionImpl::createConnection(void)
{
    // TODO shouldn't be this method reenteant?
    static QAtomicInt ID_COUNTER(0);
    int ID = ID_COUNTER.fetchAndAddAcquire(1);

    QString dbName = QString::number(ID);
    QSqlDatabase db = QSqlDatabase::addDatabase(parentConnection().provider(), dbName);
    db.setDatabaseName(parentConnection().database());
    QString host = parentConnection().host();
    int pos = host.indexOf(QString(":"));
    if (pos < 0)
        db.setHostName(host);
    else
    {
        db.setHostName(host.mid(0, pos));
        db.setPort(host.mid(pos + 1).toInt());
    }

    QString opt;

    QSet<QString> options = parentConnection().options();
    if (options.find("Compress") != options.end())
        opt += ";CLIENT_COMPRESS";
    if (options.find("Ignore Space") != options.end())
        opt += ";CLIENT_IGNORE_SPACE";
    if (options.find("No Schema") != options.end())
        opt += ";CLIENT_NO_SCHEMA";
    if (options.find("SSL") != options.end())
        opt += ";CLIENT_SSL";

    if (!opt.isEmpty())
        db.setConnectOptions(opt.mid(1)); // Strip first ; character

    db.open(parentConnection().user(), parentConnection().password());
    if (!db.isOpen())
    {
        QString t = toQPSqlConnectionSub::ErrorString(db.lastError());
        QSqlDatabase::removeDatabase(dbName);
        throw t;
    }

    toQPSqlConnectionSub *ret = new toQPSqlConnectionSub(parentConnection(), db, dbName);
    return ret;
}
开发者ID:ShadowKyogre,项目名称:tora,代码行数:45,代码来源:toqpsqlconnection.cpp

示例3: ID_COUNTER

toConnectionSub *toQSqlConnectionImpl::createConnection(void)
{
    static QAtomicInt ID_COUNTER(0);
    int ID = ID_COUNTER.fetchAndAddAcquire(1);

    QString dbName = QString::number(ID);

    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", dbName);
    db.setDatabaseName(parentConnection().database());
    db.open(parentConnection().user(), parentConnection().password());
    if (!db.isOpen())
    {
        QString t = toQSqlConnectionSub::ErrorString(db.lastError());
        QSqlDatabase::removeDatabase(dbName);
        throw t;
    }
    toQSqlConnectionSub *ret = new toQSqlConnectionSub(parentConnection(), db, dbName);
    return ret;
}
开发者ID:tora-tool,项目名称:tora,代码行数:19,代码来源:toqsqlconnection.cpp

示例4: AddObject

int HandleManager::AddObject(AbstractController *obj)
{
    int id =  handleNum.fetchAndAddAcquire(1);
    handleMap[id] = obj;
    return id;
}
开发者ID:dalinhuang,项目名称:KeCameraPluginProject,代码行数:6,代码来源:HandleManager.cpp


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