Give asio threads separate names for better debugging
This commit is contained in:
parent
9954a3775c
commit
21724face7
2 changed files with 5 additions and 9 deletions
|
|
@ -19,7 +19,6 @@ namespace asio {
|
||||||
* @brief internal implementation types/methods for fc::asio
|
* @brief internal implementation types/methods for fc::asio
|
||||||
*/
|
*/
|
||||||
namespace detail {
|
namespace detail {
|
||||||
using namespace fc;
|
|
||||||
|
|
||||||
class read_write_handler
|
class read_write_handler
|
||||||
{
|
{
|
||||||
|
|
@ -59,14 +58,14 @@ namespace asio {
|
||||||
bool operator()( C& c, bool s ) { c.non_blocking(s); return true; }
|
bool operator()( C& c, bool s ) { c.non_blocking(s); return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#if WIN32 // windows stream handles do not support non blocking!
|
#if WIN32 // windows stream handles do not support non blocking!
|
||||||
template<>
|
template<>
|
||||||
struct non_blocking<boost::asio::windows::stream_handle> {
|
struct non_blocking<boost::asio::windows::stream_handle> {
|
||||||
typedef boost::asio::windows::stream_handle C;
|
typedef boost::asio::windows::stream_handle C;
|
||||||
bool operator()( C& ) { return false; }
|
bool operator()( C& ) { return false; }
|
||||||
bool operator()( C&, bool ) { return false; }
|
bool operator()( C&, bool ) { return false; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
} // end of namespace detail
|
} // end of namespace detail
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ namespace fc {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//elog( "${message} ", ("message", boost::system::system_error(ec).what()));
|
|
||||||
p->set_exception( fc::exception_ptr( new fc::exception(
|
p->set_exception( fc::exception_ptr( new fc::exception(
|
||||||
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
FC_LOG_MESSAGE( error, "${message} ", ("message", boost::system::system_error(ec).what())) ) ) );
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +82,6 @@ namespace fc {
|
||||||
}
|
}
|
||||||
p->set_value( eps );
|
p->set_value( eps );
|
||||||
} else {
|
} else {
|
||||||
//elog( "%s", boost::system::system_error(ec).what() );
|
|
||||||
//p->set_exception( fc::copy_exception( boost::system::system_error(ec) ) );
|
|
||||||
p->set_exception(
|
p->set_exception(
|
||||||
fc::exception_ptr( new fc::exception(
|
fc::exception_ptr( new fc::exception(
|
||||||
FC_LOG_MESSAGE( error, "process exited with: ${message} ",
|
FC_LOG_MESSAGE( error, "process exited with: ${message} ",
|
||||||
|
|
@ -125,9 +122,9 @@ namespace fc {
|
||||||
|
|
||||||
for( uint16_t i = 0; i < this->num_io_threads; ++i )
|
for( uint16_t i = 0; i < this->num_io_threads; ++i )
|
||||||
{
|
{
|
||||||
asio_threads.push_back( new boost::thread( [=]()
|
asio_threads.push_back( new boost::thread( [i,this]()
|
||||||
{
|
{
|
||||||
fc::thread::current().set_name("asio");
|
fc::thread::current().set_name( "fc::asio worker #" + fc::to_string(i) );
|
||||||
|
|
||||||
BOOST_SCOPE_EXIT(void)
|
BOOST_SCOPE_EXIT(void)
|
||||||
{
|
{
|
||||||
|
|
@ -194,7 +191,7 @@ namespace fc {
|
||||||
promise<std::vector<boost::asio::ip::tcp::endpoint> >::ptr p( new promise<std::vector<boost::asio::ip::tcp::endpoint> >("tcp::resolve completion") );
|
promise<std::vector<boost::asio::ip::tcp::endpoint> >::ptr p( new promise<std::vector<boost::asio::ip::tcp::endpoint> >("tcp::resolve completion") );
|
||||||
res.async_resolve( boost::asio::ip::tcp::resolver::query(hostname,port),
|
res.async_resolve( boost::asio::ip::tcp::resolver::query(hostname,port),
|
||||||
boost::bind( detail::resolve_handler<boost::asio::ip::tcp::endpoint,resolver_iterator>, p, _1, _2 ) );
|
boost::bind( detail::resolve_handler<boost::asio::ip::tcp::endpoint,resolver_iterator>, p, _1, _2 ) );
|
||||||
return p->wait();;
|
return p->wait();
|
||||||
}
|
}
|
||||||
FC_RETHROW_EXCEPTIONS(warn, "")
|
FC_RETHROW_EXCEPTIONS(warn, "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue