diff --git a/examples/asio-sv.cc b/examples/asio-sv.cc index 88bebec3..f942eef8 100644 --- a/examples/asio-sv.cc +++ b/examples/asio-sv.cc @@ -42,13 +42,6 @@ using namespace nghttp2::asio_http2; using namespace nghttp2::asio_http2::server; -void all_threads_created_cb( - std::vector> all_threads_info) { - for (auto thread_info : all_threads_info) { - std::cout << "thread pid: " << thread_info->pid << std::endl; - } -} - int main(int argc, char *argv[]) { try { // Check command line arguments. @@ -69,7 +62,12 @@ int main(int argc, char *argv[]) { server.num_threads(num_threads); - server.set_on_all_threads_created_callback(all_threads_created_cb); + server.set_on_all_threads_created_callback( + [](const auto &all_threads_info) { + for (auto &thread_info : all_threads_info) { + std::cout << "thread pid: " << thread_info->pid << std::endl; + } + }); server.handle("/", [](const request &req, const response &res) { res.write_head(200, {{"foo", {"bar"}}}); diff --git a/src/asio_server.cc b/src/asio_server.cc index 996a9986..bedb5e22 100644 --- a/src/asio_server.cc +++ b/src/asio_server.cc @@ -71,7 +71,7 @@ server::listen_and_serve(boost::system::error_code &ec, } } - io_service_pool_.run(asynchronous, all_threads_created_cb); + io_service_pool_.run(asynchronous, std::move(all_threads_created_cb)); return ec; } diff --git a/src/asio_server_http2_impl.cc b/src/asio_server_http2_impl.cc index 2e1a6ad1..f0ecf71f 100644 --- a/src/asio_server_http2_impl.cc +++ b/src/asio_server_http2_impl.cc @@ -59,7 +59,7 @@ void http2_impl::backlog(int backlog) { backlog_ = backlog; } void http2_impl::set_on_all_threads_created_callback( on_all_threads_created_cb cb) { - all_threads_created_cb_ = cb; + all_threads_created_cb_ = std::move(cb); } void http2_impl::tls_handshake_timeout(