Skip to content

Commit cc1d5ea

Browse files
committed
Conditional async_client liftetime_thread creation
Create a thread and add it to io_service only if io_service is internal. If internal - do not change it.
1 parent 28ba508 commit cc1d5ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

boost/network/protocol/http/client/async_impl.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ struct async_client
5757
always_verify_peer_(always_verify_peer) {
5858
connection_base::resolver_strand_.reset(
5959
new boost::asio::io_service::strand(service_));
60-
lifetime_thread_.reset(new boost::thread(
61-
boost::bind(&boost::asio::io_service::run, &service_)));
60+
if(service)
61+
lifetime_thread_.reset(new boost::thread(
62+
boost::bind(&boost::asio::io_service::run, &service_)));
6263
}
6364

6465
~async_client() throw() {

0 commit comments

Comments
 (0)