本文整理汇总了C++中io_service::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ io_service::stop方法的具体用法?C++ io_service::stop怎么用?C++ io_service::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io_service
的用法示例。
在下文中一共展示了io_service::stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handler
void handler(const boost::system::error_code& error, int signal_number) {
if (!error) {
cerr << "SIGNAL(" << signal_number <<
") : Caught SIGINT(SIGTERM)." << endl;
io.stop();
} else {
cerr << "SIGNAL(" << signal_number << ") : Error." << endl;
}
}
示例2: on_exit
///退出
void talk_to_svr::on_exit(const std::string &msg)
{
std::string answer;
std::istringstream iss(msg);
iss >> answer >> answer;
if (answer.find("succeed") == 0) {
stop();
service.stop();
_csignal = ok_exit;
}
}
示例3:
void
request_timeout ()
{
retry_timer.cancel();
death_timer.cancel();
// just tear everything down at this point.
if( socket.is_open() )
socket.close();
if( requestCount.dec() == 0 )
ioservice.stop();
}
示例4: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
char host[20] = "127.1.1.1";
unsigned short port = 10080;
if( argc > 1 ) {
::wcstombs( host, argv[1], sizeof(host) );
}
if( argc > 2 ) {
try {
port = lexical_cast<unsigned short>( wstring(argv[2]) );
} catch( const bad_lexical_cast & ) {
cout << "input port illegal. expected unsigned short value, but ";
wcout << argv[2] << endl;
}
}
try {
io_service::work work(ios_);
run_service( ios_ );
shared_ptr<fastnetwork::io_connector> connector( new udp::udp_connector( ios_ ) );
connector->set_handler( session_created );
// connector->connect( ip::udp::endpoint( ip::address_v4::from_string(host), port ) );
// while using ip::address_v4::from_string(host), async_receive_from won't work
// I don't know why.
connector->connect( ip::udp::endpoint( ip::address_v4::from_string("127.0.0.1"), port ) );
while ( true ) {
if ( ! client ) {
::Sleep(1000);
} else {
read_send( client );
// break;
}
}
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
ios_.stop();
while( true ) {
::Sleep( 10000 );
}
return 0;
}
示例5: stopBTTrackers
void stopBTTrackers()
{
g_IOService.stop();
g_Thread.join();
}
示例6: stopModule
void stopModule(io_service & ios)
{
ios.stop();
}