diff --git a/src/io/iostream.cpp b/src/io/iostream.cpp index 5a01cc7..7ad272d 100644 --- a/src/io/iostream.cpp +++ b/src/io/iostream.cpp @@ -17,7 +17,7 @@ namespace fc { struct cin_buffer { cin_buffer():eof(false),write_pos(0),read_pos(0),cinthread("cin"){ - cinthread.async( [=](){read();} ); + cinthread.async( [=](){read();}, "cin_buffer::read" ); } void read() { diff --git a/src/log/file_appender.cpp b/src/log/file_appender.cpp index f537da5..d53c1fc 100644 --- a/src/log/file_appender.cpp +++ b/src/log/file_appender.cpp @@ -49,7 +49,7 @@ namespace fc { FC_ASSERT( _compression_thread ); if( !_compression_thread->is_current() ) { - _compression_thread->async( [this, filename]() { compress_file( filename ); } ).wait(); + _compression_thread->async( [this, filename]() { compress_file( filename ); }, "compress_file" ).wait(); return; } @@ -74,7 +74,7 @@ namespace fc { if( cfg.rotation_compression ) _compression_thread.reset( new thread( "compression") ); - _rotation_task = async( [this]() { rotate_files( true ); } ); + _rotation_task = async( [this]() { rotate_files( true ); }, "rotate_files" ); } } diff --git a/src/network/http/http_server.cpp b/src/network/http/http_server.cpp index b9c7302..6560cd4 100644 --- a/src/network/http/http_server.cpp +++ b/src/network/http/http_server.cpp @@ -50,7 +50,7 @@ namespace fc { namespace http { impl(){} impl(const fc::ip::endpoint& p ) { tcp_serv.listen(p); - accept_complete = fc::async([this](){ this->accept_loop(); }); + accept_complete = fc::async([this](){ this->accept_loop(); }, "http_server accept_loop"); } fc::future accept_complete; ~impl() { @@ -66,7 +66,7 @@ namespace fc { namespace http { http::connection_ptr con = std::make_shared(); tcp_serv.accept( con->get_socket() ); //ilog( "Accept Connection" ); - fc::async( [=](){ handle_connection( con, on_req ); } ); + fc::async( [=](){ handle_connection( con, on_req ); }, "http_server handle_connection" ); } } @@ -144,7 +144,7 @@ namespace fc { namespace http { if( false || my->handle_next_req ) { ilog( "handle next request..." ); //fc::async( std::function(my->handle_next_req) ); - fc::async( my->handle_next_req ); + fc::async( my->handle_next_req, "http_server handle_next_req" ); } } } diff --git a/src/network/ntp.cpp b/src/network/ntp.cpp index bfe428e..3d9fb3e 100644 --- a/src/network/ntp.cpp +++ b/src/network/ntp.cpp @@ -160,7 +160,7 @@ namespace fc { wlog( "Exception thrown while shutting down NTP's read_loop, ignoring" ); } - }).wait(); + }, "ntp_shutdown_task").wait(); } diff --git a/src/network/rate_limiting.cpp b/src/network/rate_limiting.cpp index fe69277..ad90f4b 100644 --- a/src/network/rate_limiting.cpp +++ b/src/network/rate_limiting.cpp @@ -213,7 +213,7 @@ namespace fc // launch the read processing loop it if isn't running, or signal it to resume if it's paused. if (!_process_pending_reads_loop_complete.valid() || _process_pending_reads_loop_complete.ready()) - _process_pending_reads_loop_complete = async([=](){ process_pending_reads(); }); + _process_pending_reads_loop_complete = async([=](){ process_pending_reads(); }, "process_pending_reads" ); else if (_new_read_operation_available_promise) _new_read_operation_available_promise->set_value(); @@ -238,7 +238,7 @@ namespace fc // launch the write processing loop it if isn't running, or signal it to resume if it's paused. if (!_process_pending_writes_loop_complete.valid() || _process_pending_writes_loop_complete.ready()) - _process_pending_writes_loop_complete = async([=](){ process_pending_writes(); }); + _process_pending_writes_loop_complete = async([=](){ process_pending_writes(); }, "process_pending_writes"); else if (_new_write_operation_available_promise) _new_write_operation_available_promise->set_value(); diff --git a/src/network/udt_socket.cpp b/src/network/udt_socket.cpp index a065aac..464c55c 100644 --- a/src/network/udt_socket.cpp +++ b/src/network/udt_socket.cpp @@ -31,7 +31,7 @@ namespace fc { UDT::startup(); check_udt_errors(); _epoll_id = UDT::epoll_create(); - _epoll_loop = _epoll_thread.async( [=](){ poll_loop(); } ); + _epoll_loop = _epoll_thread.async( [=](){ poll_loop(); }, "udt_poll_loop" ); } ~udt_epoll_service() diff --git a/src/rpc/json_connection.cpp b/src/rpc/json_connection.cpp index fa01fd0..fa6273b 100644 --- a/src/rpc/json_connection.cpp +++ b/src/rpc/json_connection.cpp @@ -204,7 +204,7 @@ namespace fc { namespace rpc { variant v = json::from_stream(*_in); ///ilog( "input: ${in}", ("in", v ) ); //wlog( "recv: ${line}", ("line", line) ); - fc::async([=](){ handle_message(v.get_object()); }); + fc::async([=](){ handle_message(v.get_object()); }, "json_connection handle_message"); } } catch ( eof_exception& eof ) @@ -263,7 +263,7 @@ namespace fc { namespace rpc { { FC_THROW_EXCEPTION( assert_exception, "start should only be called once" ); } - return my->_done = fc::async( [=](){ my->read_loop(); } ); + return my->_done = fc::async( [=](){ my->read_loop(); }, "json_connection read_loop" ); } void json_connection::add_method( const fc::string& name, method m ) diff --git a/src/thread/thread.cpp b/src/thread/thread.cpp index 6968417..aa00c65 100644 --- a/src/thread/thread.cpp +++ b/src/thread/thread.cpp @@ -129,7 +129,7 @@ namespace fc { //if quitting from a different thread, start quit task on thread. //If we have and know our attached boost thread, wait for it to finish, then return. if( ¤t() != this ) { - async( [=](){quit();} );//.wait(); + async( [=](){quit();}, "thread::quit" );//.wait(); if( my->boost_thread ) { auto n = name(); my->boost_thread->join(); @@ -139,7 +139,7 @@ namespace fc { return; } - wlog( "${s}", ("s",name()) ); + //wlog( "${s}", ("s",name()) ); // We are quiting from our own thread... // break all promises, thread quit! @@ -155,7 +155,7 @@ namespace fc { cur = n; } if( my->blocked ) { - wlog( "still blocking... whats up with that?"); + //wlog( "still blocking... whats up with that?"); debug( "on quit" ); } } @@ -289,6 +289,7 @@ namespace fc { void thread::async_task( task_base* t, const priority& p, const time_point& tp, const char* desc ) { assert(my); t->_when = tp; + t->_desc = desc; // slog( "when %lld", t->_when.time_since_epoch().count() ); // slog( "delay %lld", (tp - fc::time_point::now()).count() ); task_base* stale_head = my->task_in_queue.load(boost::memory_order_relaxed);