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


C++ Threads::end方法代码示例

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


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

示例1: gdbmiThreadList

std::string gdbmiThreadList(CIDebugSystemObjects *debugSystemObjects,
                            CIDebugSymbols *debugSymbols,
                            CIDebugControl *debugControl,
                            CIDebugAdvanced *debugAdvanced,
                            std::string *errorMessage)
{
    Threads threads;
    ULONG currentThreadId;
    if (!threadList(debugSystemObjects, debugSymbols, debugControl,
                    debugAdvanced, &threads, &currentThreadId, errorMessage))
        return std::string();
    std::ostringstream str;
    str << "{threads=[";
    const Threads::const_iterator cend = threads.end();
    for (Threads::const_iterator it = threads.begin(); it != cend; ++it)
        it->formatGDBMI(str);
    str << "],current-thread-id=\"" << currentThreadId << "\"}";
    return str.str();
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:19,代码来源:gdbmihelpers.cpp

示例2: main


//.........这里部分代码省略.........
        osg::Vec3 center(0.5f,0.5f,0.5f);
        float diameter = 1.0f;

        osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
        if (loadedModel.valid())
        {
            mainGroup->addChild(loadedModel.get());

            center = loadedModel->getBound().center();
            diameter = loadedModel->getBound().radius() * 2.0f;
        }

        for(unsigned int i=0; i<numThreads; ++i)
        {
            osg::Group* textGroup = new osg::Group;
            mainGroup->addChild(textGroup);

            // create the background thread
            osg::OperationThread* operationThread = new osg::OperationThread;

            operationThreads.push_back(operationThread);

            // create the operation that will run in the background and
            // sync once per frame with the main viewer loop.
            updateOperation = new UpdateTextOperation(center, diameter, textGroup);

            // add the operation to the operation thread and start it.
            operationThread->add(updateOperation.get());
            operationThread->startThread();

            // add the operation to the viewer to sync once per frame.
            viewer.addUpdateOperation(updateOperation.get());


            // add a unit cube for the text to appear within.
            osg::Geode* geode = new osg::Geode;
            geode->getOrCreateStateSet()->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE));
            geode->addDrawable(new osg::ShapeDrawable(new osg::Box(center,diameter)));

            mainGroup->addChild(geode);
        }

        viewer.setSceneData(mainGroup);
    }
    else
    {
        // prepare scene.
        osg::Vec3 center(0.0f,0.0f,0.0f);
        float radius = 1.0f;

        // make sure the root node is group so we can add extra nodes to it.
        osg::Group* group = new osg::Group;

        if (true)
        {
            // create the hud.
            osg::Camera* camera = new osg::Camera;
            camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
            camera->setProjectionMatrixAsOrtho2D(0,1280,0,1024);
            camera->setViewMatrix(osg::Matrix::identity());
            camera->setClearMask(GL_DEPTH_BUFFER_BIT);
            camera->addChild(createHUDText());
            camera->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

            group->addChild(camera);
        }

        if (true)
        {
            group->addChild(create3DText(center,radius));
        }

        // set the scene to render
        viewer.setSceneData(group);
    }

    std::string filename;
    if (arguments.read("-o",filename))
    {
        osgDB::writeNodeFile(*viewer.getSceneData(),filename);
        return 0;
    }

    viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
    viewer.addEventHandler(new osgViewer::StatsHandler());

    viewer.run();

    if (!operationThreads.empty())
    {
        for(Threads::iterator itr = operationThreads.begin();
            itr != operationThreads.end();
            ++itr)
        {
            (*itr)->cancel();
        }
    }

    return 0;
}
开发者ID:3dcl,项目名称:osg,代码行数:101,代码来源:osgtext.cpp


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