Opened 12 years ago

Closed 12 years ago

#5007 closed Feature Requests (wontfix)

boost 1.42, asio async_resolve add thread exit method

Reported by: gongyiling <gongyiling3468@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.42.0 Severity: Not Applicable
Keywords: boost asio resolve thread Cc:

Description

In our project, we use boost::asio::ip::tcp::resolver as DNS resolver, but found a problem, that is: a thread was created during the resolving process, and didn't quit when resolve finished, making it hard to slim project's threads number. so, I dig into the source code, blabla, and fixed this "problem" i'm new to this stuff, so to be good, i paste diff code here:

diff -urN asio_old/ip/basic_resolver.hpp asio/ip/basic_resolver.hpp
--- asio_old/ip/basic_resolver.hpp	2010-01-04 04:36:02.000000000 +0800
+++ asio/ip/basic_resolver.hpp	2010-12-20 22:02:33.369834300 +0800
@@ -237,6 +237,11 @@
   {
     return this->service.async_resolve(this->implementation, e, handler);
   }
+
+  void shutdown_service()
+  {
+	  this->service.shutdown_service();
+  }
 };
 
 } // namespace ip
diff -urN asio_old/ip/resolver_service.hpp asio/ip/resolver_service.hpp
--- asio_old/ip/resolver_service.hpp	2010-01-04 04:36:02.000000000 +0800
+++ asio/ip/resolver_service.hpp	2010-12-20 21:56:38.610543300 +0800
@@ -78,6 +78,7 @@
   /// Destroy all user-defined handler objects owned by the service.
   void shutdown_service()
   {
+	  service_impl_.shutdown_service();
   }
 
   /// Construct a new resolver implementation.

Change History (1)

comment:1 by chris_kohlhoff, 12 years ago

Resolution: wontfix
Severity: ProblemNot Applicable
Status: newclosed
Type: PatchesFeature Requests

The thread is cached for use by subsequent async_resolve operations. This is by design.

Note: See TracTickets for help on using tickets.