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


C++ io_service::run方法代码示例

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


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

示例1: joinThreadPool

inline void AsioThreadPool::joinThreadPool()
{
    m_io_svc.run();
}
开发者ID:ConfusedReality,项目名称:pkg_multithreading_thread-pool-cpp,代码行数:4,代码来源:asio_thread_pool.hpp

示例2: asioFunction

static void asioFunction()
{
	boost::asio::io_service::work work(ioService);
	ioService.run();
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:5,代码来源:SC_ComPort.cpp

示例3: start

 void start( void ){
     _accept();
     m_ioService.run();
 }
开发者ID:CaptainOz,项目名称:ASIOTutorial,代码行数:4,代码来源:server.cpp

示例4: Start

bool TCPClient::Start(boost::asio::io_service& IOService){
	IOService.run();
	return true;
}
开发者ID:medikid,项目名称:OHClient,代码行数:4,代码来源:TCPClient.cpp

示例5: main

int main(int argc, char** argv)
{
	std::string configFile = _TOURNAMENT_REALM_CONFIG;
    auto vm = GetConsoleArguments(argc, argv, configFile);
    // exit if help is enabled
    if (vm.count("help"))
        return 0;

    std::string configError;
    if (!sConfigMgr->LoadInitial(configFile, configError))
    {
        printf("Error in config file: %s\n", configError.c_str());
        return 1;
    }

    TC_LOG_INFO("server.authserver", "%s (authserver)", _FULLVERSION);
    TC_LOG_INFO("server.authserver", "<Ctrl-C> to stop.\n");
    TC_LOG_INFO("server.authserver", "Using configuration file %s.", configFile.c_str());
    TC_LOG_INFO("server.authserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
    TC_LOG_INFO("server.authserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);

    // authserver PID file creation
    std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
    if (!pidFile.empty())
    {
        if (uint32 pid = CreatePIDFile(pidFile))
            TC_LOG_INFO("server.authserver", "Daemon PID: %u\n", pid);
        else
        {
            TC_LOG_ERROR("server.authserver", "Cannot create PID file %s.\n", pidFile.c_str());
            return 1;
        }
    }

    // Initialize the database connection
    if (!StartDB())
        return 1;

    // Get the list of realms for the server
    sRealmList->Initialize(_ioService, sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 20));

    if (sRealmList->size() == 0)
    {
        TC_LOG_ERROR("server.authserver", "No valid realms specified.");
        StopDB();
        return 1;
    }

    // Start the listening port (acceptor) for auth connections
    int32 port = sConfigMgr->GetIntDefault("RealmServerPort", 3724);
    if (port < 0 || port > 0xFFFF)
    {
        TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)");
        StopDB();
        return 1;
    }

    std::string bindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");

    sAuthSocketMgr.StartNetwork(_ioService, bindIp, port);

    // Set signal handlers
    boost::asio::signal_set signals(_ioService, SIGINT, SIGTERM);
#if PLATFORM == PLATFORM_WINDOWS
    signals.add(SIGBREAK);
#endif
    signals.async_wait(SignalHandler);

    // Set process priority according to configuration settings
    SetProcessPriority("server.authserver");

    // Enabled a timed callback for handling the database keep alive ping
    _dbPingInterval = sConfigMgr->GetIntDefault("MaxPingTime", 30);
    _dbPingTimer.expires_from_now(boost::posix_time::minutes(_dbPingInterval));
    _dbPingTimer.async_wait(KeepDatabaseAliveHandler);

    // Start the io service worker loop
    _ioService.run();

    // Close the Database Pool and library
    StopDB();

    TC_LOG_INFO("server.authserver", "Halting process...");
    return 0;
}
开发者ID:mysql1,项目名称:TournamentCore,代码行数:85,代码来源:Main.cpp

示例6: run

 void run() {
     while (should_run) {
         ios.run();
         ios.reset();
     }
 }
开发者ID:tempbottle,项目名称:vanillacoin,代码行数:6,代码来源:upnp_client.cpp

示例7: thread_proc

	void thread_proc()
	{
		worker_service_.run();
	}
开发者ID:mpapierski,项目名称:filesystem_service,代码行数:4,代码来源:filesystem_service.hpp

示例8: test

void test()
{
	timer_.expires_from_now(milliseconds(0));
	timer_.async_wait(boost::bind(case1, boost::asio::placeholders::error));
	io_service_.run();
}
开发者ID:CCJY,项目名称:coliru,代码行数:6,代码来源:main.cpp

示例9: run

	void run()
	{
		accept();
		io.run();
	}
开发者ID:yvt,项目名称:xstream,代码行数:5,代码来源:xstream.cpp

示例10: WorkerThread

void WorkerThread(){
    Debug("Thread Start");
    io_service.run();
    Debug("Thread Finish");
}
开发者ID:nannanwuhui,项目名称:C-,代码行数:5,代码来源:main.cpp

示例11: operator

	void operator()() const
	{
		service->run();
	}
开发者ID:minaevmike,项目名称:swarm,代码行数:4,代码来源:client.cpp

示例12:

void async_udp::tests_::detail::service_thread( boost::asio::io_service& service )
{
	service.run();
}
开发者ID:Aljaksandr,项目名称:cpp_craft_1013,代码行数:4,代码来源:udp_listener_tests.cpp

示例13: service_run

static void service_run(boost::asio::io_service& service)
{
    service.run();
}
开发者ID:dmitrymatveev-work,项目名称:cpp_craft_0314,代码行数:4,代码来源:main.cpp

示例14: WorkerThread

 void IoServicesImpl::WorkerThread(boost::asio::io_service& ioService) {
     // std::cout << "hello worker" << std::endl;
     ioService.run();
     // std::cout << "Goodbye worker" << std::endl;
 }
开发者ID:chenbk85,项目名称:HelloBoostIoServices,代码行数:5,代码来源:IoServicesImpl.cpp

示例15: run

 void run(){
     cuv::initCUDA(id);
     cuv::initialize_mersenne_twister_seeds();
     this->reg(ios,1);
     ios.run();
 }
开发者ID:deeplearningais,项目名称:cuvnet,代码行数:6,代码来源:hyperopt.cpp


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