本文整理汇总了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();
}
示例2: asioFunction
static void asioFunction()
{
boost::asio::io_service::work work(ioService);
ioService.run();
}
示例3: start
void start( void ){
_accept();
m_ioService.run();
}
示例4: Start
bool TCPClient::Start(boost::asio::io_service& IOService){
IOService.run();
return true;
}
示例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;
}
示例6: run
void run() {
while (should_run) {
ios.run();
ios.reset();
}
}
示例7: thread_proc
void thread_proc()
{
worker_service_.run();
}
示例8: test
void test()
{
timer_.expires_from_now(milliseconds(0));
timer_.async_wait(boost::bind(case1, boost::asio::placeholders::error));
io_service_.run();
}
示例10: WorkerThread
void WorkerThread(){
Debug("Thread Start");
io_service.run();
Debug("Thread Finish");
}
示例11: operator
void operator()() const
{
service->run();
}
示例12:
void async_udp::tests_::detail::service_thread( boost::asio::io_service& service )
{
service.run();
}
示例13: service_run
static void service_run(boost::asio::io_service& service)
{
service.run();
}
示例14: WorkerThread
void IoServicesImpl::WorkerThread(boost::asio::io_service& ioService) {
// std::cout << "hello worker" << std::endl;
ioService.run();
// std::cout << "Goodbye worker" << std::endl;
}
示例15: run
void run(){
cuv::initCUDA(id);
cuv::initialize_mersenne_twister_seeds();
this->reg(ios,1);
ios.run();
}