diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 7cf326008e..8b7f0e9e13 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1199,7 +1199,10 @@ struct controller_impl { if( shutdown ) shutdown(); } ); if (cfg.vote_thread_pool_size > 0) { - vote_processor.start(cfg.vote_thread_pool_size); + vote_processor.start(cfg.vote_thread_pool_size, [this]( const fc::exception& e ) { + elog( "Exception in vote thread pool, exiting: ${e}", ("e", e.to_detail_string()) ); + if( shutdown ) shutdown(); + } ); } set_activation_handler(); diff --git a/libraries/chain/include/eosio/chain/vote_processor.hpp b/libraries/chain/include/eosio/chain/vote_processor.hpp index 90719df5d4..337162b65b 100644 --- a/libraries/chain/include/eosio/chain/vote_processor.hpp +++ b/libraries/chain/include/eosio/chain/vote_processor.hpp @@ -122,11 +122,9 @@ class vote_processor_t { cv.notify_one(); } - void start(size_t num_threads) { + void start(size_t num_threads, decltype(thread_pool)::on_except_t&& on_except) { assert(num_threads > 1); // need at least two as one is used for coordinatation - thread_pool.start( num_threads, []( const fc::exception& e ) { - elog( "Exception in vote processor thread pool, exiting: ${e}", ("e", e.to_detail_string()) ); - } ); + thread_pool.start( num_threads, std::move(on_except)); // one coordinator thread boost::asio::post(thread_pool.get_executor(), [&]() {