• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ executor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tick

	void tick()
	{
		if(!window_)
			return;

		sf::Event e;
		while(window_->GetEvent(e))
		{
			if(e.Type == sf::Event::Closed)
			{
				window_.reset();
				return;
			}
		}		

		try
		{
			glClear(GL_COLOR_BUFFER_BIT);
			window_->Draw(*this);
			window_->Display();
			boost::this_thread::sleep(boost::posix_time::milliseconds(10));
		}
		catch (...)
		{
			CASPAR_LOG_CURRENT_EXCEPTION();
			CASPAR_LOG(error)
					<< L"Closing diag window due to error during rendering";
			window_.reset();
			return;
		}

		executor_.begin_invoke([this]{tick();});
	}
开发者ID:zhouqilin,项目名称:casparLinux,代码行数:33,代码来源:graph.cpp


示例2: send

	virtual boost::unique_future<bool> send(const safe_ptr<core::read_frame>& frame) override
	{
		CASPAR_VERIFY(format_desc_.height * format_desc_.width * 4 == static_cast<unsigned>(frame->image_data().size()));

		return executor_.begin_invoke([=]() -> bool
		{			
			graph_->set_value("tick-time", tick_timer_.elapsed() * format_desc_.fps * 0.5);
			tick_timer_.restart();
			frame_timer_.restart();

			// AUDIO

			std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>> audio_buffer;

			if (core::needs_rearranging(
					frame->multichannel_view(),
					channel_layout_,
					channel_layout_.num_channels))
			{
				core::audio_buffer downmixed;

				downmixed.resize(
						frame->multichannel_view().num_samples() 
								* channel_layout_.num_channels,
						0);

				auto dest_view = core::make_multichannel_view<int32_t>(
						downmixed.begin(), downmixed.end(), channel_layout_);

				core::rearrange_or_rearrange_and_mix(
						frame->multichannel_view(),
						dest_view,
						core::default_mix_config_repository());

				audio_buffer = core::audio_32_to_16(downmixed);
			}
			else
			{
				audio_buffer = core::audio_32_to_16(frame->audio_data());
			}

			airsend::add_audio(air_send_.get(), audio_buffer.data(), audio_buffer.size() / channel_layout_.num_channels);

			// VIDEO

			connected_ = airsend::add_frame_bgra(air_send_.get(), frame->image_data().begin());

			graph_->set_text(print());
			graph_->set_value("frame-time", frame_timer_.elapsed() * format_desc_.fps * 0.5);
			
			return true;
		});
	}
开发者ID:GamingAtheist,项目名称:Server,代码行数:53,代码来源:newtek_ivga_consumer.cpp


示例3: pre_fork_parent

 void pre_fork_parent(executor& e) const
 {
     {
         int pipe_fds[2] = {-1, -1};
         
         ::pipe(pipe_fds);
         
          m_read_end = ensure_user_fd_index(pipe_fds[0]); if( m_read_end != pipe_fds[0]) close(pipe_fds[0]);
         m_write_end = ensure_user_fd_index(pipe_fds[1]); if(m_write_end != pipe_fds[1]) close(pipe_fds[1]);
     }
     
     signal(SIGPIPE, SIG_IGN); // Who's to say this doesn't change elsewhere
     
     fcntl( m_read_end, F_SETFD, FD_CLOEXEC|fcntl( m_read_end, F_GETFD, 0)); 
     fcntl(m_write_end, F_SETFD, FD_CLOEXEC|fcntl(m_write_end, F_GETFD, 0));
     
     e.set_in_use(m_write_end); 
 }
开发者ID:DannyHavenith,项目名称:boost-process,代码行数:18,代码来源:executor.hpp


示例4: pre_fork_parent

            void pre_fork_parent(executor& e) const
            {
                {
                    int pipe_fds[2] = {-1, -1};
                    
                    if(!::pipe(pipe_fds))
                    {
                        throw boost::system::system_error(boost::system::error_code(errno, boost::system::system_category()));
                    }

                     m_read_end = ensure_user_fd_index(pipe_fds[0]); if( m_read_end != pipe_fds[0]) close(pipe_fds[0]);
                    m_write_end = ensure_user_fd_index(pipe_fds[1]); if(m_write_end != pipe_fds[1]) close(pipe_fds[1]);
                }
                
                signal(SIGPIPE, SIG_IGN); // Who's to say this doesn't change elsewhere
                
                fcntl( m_read_end, F_SETFD, FD_CLOEXEC|fcntl( m_read_end, F_GETFD, 0)); 
                fcntl(m_write_end, F_SETFD, FD_CLOEXEC|fcntl(m_write_end, F_GETFD, 0));
                
                e.set_in_use(m_write_end); 
            }
开发者ID:leutloff,项目名称:boost-process,代码行数:21,代码来源:executor.hpp


示例5: context

	context() : executor_(L"diagnostics")
	{
		executor_.set_priority_class(below_normal_priority_class);
	}
开发者ID:zhouqilin,项目名称:casparLinux,代码行数:4,代码来源:graph.cpp


示例6:

std::vector<RemoteCommandRequest> VoteRequester::Algorithm::getRequests() const {
    BSONObjBuilder requestVotesCmdBuilder;
    requestVotesCmdBuilder.append("replSetRequestVotes", 1);
    requestVotesCmdBuilder.append("setName", _rsConfig.getReplSetName());
    requestVotesCmdBuilder.append("dryRun", _dryRun);
    requestVotesCmdBuilder.append("term", _term);
    requestVotesCmdBuilder.append("candidateIndex", _candidateIndex);
    requestVotesCmdBuilder.append("configVersion", _rsConfig.getConfigVersion());

    _lastDurableOpTime.append(&requestVotesCmdBuilder, "lastCommittedOp");

    const BSONObj requestVotesCmd = requestVotesCmdBuilder.obj();

    std::vector<RemoteCommandRequest> requests;
    for (const auto& target : _targets) {
        requests.push_back(RemoteCommandRequest(
            target,
            "admin",
            requestVotesCmd,
            nullptr,
            std::min(_rsConfig.getElectionTimeoutPeriod(), maximumVoteRequestTimeoutMS)));
    }

    return requests;
}
开发者ID:louiswilliams,项目名称:mongo,代码行数:25,代码来源:vote_requester.cpp


示例7: invariant

std::vector<RemoteCommandRequest> ElectCmdRunner::Algorithm::getRequests() const {
    const MemberConfig& selfConfig = _rsConfig.getMemberAt(_selfIndex);
    std::vector<RemoteCommandRequest> requests;
    BSONObjBuilder electCmdBuilder;
    electCmdBuilder.append("replSetElect", 1);
    electCmdBuilder.append("set", _rsConfig.getReplSetName());
    electCmdBuilder.append("who", selfConfig.getHostAndPort().toString());
    electCmdBuilder.append("whoid", selfConfig.getId());
    electCmdBuilder.appendIntOrLL("cfgver", _rsConfig.getConfigVersion());
    electCmdBuilder.append("round", _round);
    const BSONObj replSetElectCmd = electCmdBuilder.obj();

    // Schedule a RemoteCommandRequest for each non-DOWN node
    for (std::vector<HostAndPort>::const_iterator it = _targets.begin(); it != _targets.end();
         ++it) {
        invariant(*it != selfConfig.getHostAndPort());
        requests.push_back(RemoteCommandRequest(
            *it,
            "admin",
            replSetElectCmd,
            Milliseconds(30 * 1000)));  // trying to match current Socket timeout
    }

    return requests;
}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:25,代码来源:elect_cmd_runner.cpp


示例8: makeResponseStatus

ResponseStatus ReplCoordTest::makeResponseStatus(const BSONObj& doc,
                                                 const BSONObj& metadata,
                                                 Milliseconds millis) {
    log() << "Responding with " << doc << " (metadata: " << metadata << "; elapsed: " << millis
          << ")";
    return ResponseStatus(RemoteCommandResponse(doc, metadata, millis));
}
开发者ID:FHIRBUFF,项目名称:mongo,代码行数:7,代码来源:replication_coordinator_test_fixture.cpp


示例9: invariant

std::vector<RemoteCommandRequest> FreshnessChecker::Algorithm::getRequests() const {
    const MemberConfig& selfConfig = _rsConfig.getMemberAt(_selfIndex);

    // gather all not-down nodes, get their fullnames(or hostandport's)
    // schedule fresh command for each node
    BSONObjBuilder freshCmdBuilder;
    freshCmdBuilder.append("replSetFresh", 1);
    freshCmdBuilder.append("set", _rsConfig.getReplSetName());
    freshCmdBuilder.append("opTime", Date_t::fromMillisSinceEpoch(_lastOpTimeApplied.asLL()));
    freshCmdBuilder.append("who", selfConfig.getHostAndPort().toString());
    freshCmdBuilder.appendIntOrLL("cfgver", _rsConfig.getConfigVersion());
    freshCmdBuilder.append("id", selfConfig.getId());
    const BSONObj replSetFreshCmd = freshCmdBuilder.obj();

    std::vector<RemoteCommandRequest> requests;
    for (std::vector<HostAndPort>::const_iterator it = _targets.begin(); it != _targets.end();
         ++it) {
        invariant(*it != selfConfig.getHostAndPort());
        requests.push_back(RemoteCommandRequest(
            *it,
            "admin",
            replSetFreshCmd,
            Milliseconds(30 * 1000)));  // trying to match current Socket timeout
    }

    return requests;
}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:27,代码来源:freshness_checker.cpp


示例10:

std::vector<RemoteCommandRequest> FreshnessScanner::Algorithm::getRequests() const {
    BSONObjBuilder cmdBuilder;
    cmdBuilder << "replSetGetStatus" << 1;
    const BSONObj getStatusCmd = cmdBuilder.obj();

    std::vector<RemoteCommandRequest> requests;
    for (auto& target : _targets) {
        requests.push_back(RemoteCommandRequest(target, "admin", getStatusCmd, nullptr, _timeout));
    }
    return requests;
}
开发者ID:ChineseDr,项目名称:mongo,代码行数:11,代码来源:freshness_scanner.cpp


示例11: BSON

std::vector<RemoteCommandRequest> QuorumChecker::getRequests() const {
    const bool isInitialConfig = _rsConfig->getConfigVersion() == 1;
    const MemberConfig& myConfig = _rsConfig->getMemberAt(_myIndex);

    std::vector<RemoteCommandRequest> requests;
    if (hasReceivedSufficientResponses()) {
        return requests;
    }

    BSONObj hbRequest;
    if (_term == OpTime::kUninitializedTerm) {
        ReplSetHeartbeatArgs hbArgs;
        hbArgs.setSetName(_rsConfig->getReplSetName());
        hbArgs.setProtocolVersion(1);
        hbArgs.setConfigVersion(_rsConfig->getConfigVersion());
        hbArgs.setHeartbeatVersion(1);
        hbArgs.setCheckEmpty(isInitialConfig);
        hbArgs.setSenderHost(myConfig.getHostAndPort());
        hbArgs.setSenderId(myConfig.getId());
        hbRequest = hbArgs.toBSON();

    } else {
        ReplSetHeartbeatArgsV1 hbArgs;
        hbArgs.setSetName(_rsConfig->getReplSetName());
        hbArgs.setConfigVersion(_rsConfig->getConfigVersion());
        hbArgs.setHeartbeatVersion(1);
        if (isInitialConfig) {
            hbArgs.setCheckEmpty();
        }
        hbArgs.setSenderHost(myConfig.getHostAndPort());
        hbArgs.setSenderId(myConfig.getId());
        hbArgs.setTerm(_term);
        hbRequest = hbArgs.toBSON();
    }

    // Send a bunch of heartbeat requests.
    // Schedule an operation when a "sufficient" number of them have completed, and use that
    // to compute the quorum check results.
    // Wait for the "completion" callback to finish, and then it's OK to return the results.
    for (int i = 0; i < _rsConfig->getNumMembers(); ++i) {
        if (_myIndex == i) {
            // No need to check self for liveness or unreadiness.
            continue;
        }
        requests.push_back(RemoteCommandRequest(_rsConfig->getMemberAt(i).getHostAndPort(),
                                                "admin",
                                                hbRequest,
                                                BSON(rpc::kReplSetMetadataFieldName << 1),
                                                nullptr,
                                                _rsConfig->getHeartbeatTimeoutPeriodMillis()));
    }

    return requests;
}
开发者ID:zhihuiFan,项目名称:mongo,代码行数:54,代码来源:check_quorum_for_config_change.cpp


示例12: Milliseconds

std::vector<RemoteCommandRequest> ElectionWinnerDeclarer::Algorithm::getRequests() const {
    BSONObjBuilder declareElectionWinnerCmdBuilder;
    declareElectionWinnerCmdBuilder.append("replSetDeclareElectionWinner", 1);
    declareElectionWinnerCmdBuilder.append("setName", _setName);
    declareElectionWinnerCmdBuilder.append("winnerId", _winnerId);
    declareElectionWinnerCmdBuilder.append("term", _term);
    const BSONObj declareElectionWinnerCmd = declareElectionWinnerCmdBuilder.obj();

    std::vector<RemoteCommandRequest> requests;
    for (const auto& target : _targets) {
        requests.push_back(RemoteCommandRequest(
            target,
            "admin",
            declareElectionWinnerCmd,
            Milliseconds(30 * 1000)));  // trying to match current Socket timeout
    }

    return requests;
}
开发者ID:AnkyrinRepeat,项目名称:mongo,代码行数:19,代码来源:election_winner_declarer.cpp


示例13: lastCommittedOp

std::vector<RemoteCommandRequest> VoteRequester::Algorithm::getRequests() const {
    BSONObjBuilder requestVotesCmdBuilder;
    requestVotesCmdBuilder.append("replSetRequestVotes", 1);
    requestVotesCmdBuilder.append("setName", _rsConfig.getReplSetName());
    requestVotesCmdBuilder.append("dryRun", _dryRun);
    requestVotesCmdBuilder.append("term", _term);
    requestVotesCmdBuilder.append("candidateIndex", _candidateIndex);
    requestVotesCmdBuilder.append("configVersion", _rsConfig.getConfigVersion());

    BSONObjBuilder lastCommittedOp(requestVotesCmdBuilder.subobjStart("lastCommittedOp"));
    lastCommittedOp.append("ts", _lastOplogEntry.getTimestamp());
    lastCommittedOp.append("t", _lastOplogEntry.getTerm());
    lastCommittedOp.done();

    const BSONObj requestVotesCmd = requestVotesCmdBuilder.obj();

    std::vector<RemoteCommandRequest> requests;
    for (const auto& target : _targets) {
        requests.push_back(RemoteCommandRequest(
            target, "admin", requestVotesCmd, _rsConfig.getElectionTimeoutPeriod()));
    }

    return requests;
}
开发者ID:VonRosenchild,项目名称:percona-server-mongodb,代码行数:24,代码来源:vote_requester.cpp


示例14: makeResponseStatus

ResponseStatus ReplCoordTest::makeResponseStatus(const BSONObj& doc, Milliseconds millis) {
    log() << "Responding with " << doc;
    return ResponseStatus(RemoteCommandResponse(doc, BSONObj(), millis));
}
开发者ID:radik,项目名称:mongo,代码行数:4,代码来源:replication_coordinator_test_fixture.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ expr类代码示例发布时间:2022-05-31
下一篇:
C++ exception类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap