I am trying to cancel a TCP acceptor by the programs keeps blocked in that line.
One thread waits for connections like this:
boost::system::error_code ec;
acceptor_ = new boost::asio::ip::tcp::acceptor(io_service_, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
acceptor_->accept(socket_, ec); // socket_ is a boost::asio::ip::tcp:socket
The thread that must close the acceptor does:
boost::system::error_code ec;
acceptor_->close(ec);
Is there something I am missing? I am not using any async operation, so may I do something with the io_service object?