TCP resolver creates TppWorkerThreads on windows only
Hello, When I run the following code on windows, some threads are created, presumably by winsock. These threads are "named" _TppWorkerThread. This does not happen on linux. These threads do not stop when all the boost objects go out of scope, but I wish they did. Q1: Am I doing something wrong? Q2: Is there a boost way for me to stop these threads? Thank you, Chris int main() { { boost::asio::io_service DummyIoService; boost::asio::ip::tcp::resolver Resolver(DummyIoService); Resolver.resolve( boost::asio::ip::tcp::resolver::query("localhost", "3000")); } // At this point, there are three extra threads running: // // _TppWorkerThread@4 _ZwWaitForWorkViaWorkerFactory@8 // _TppWorkerThread@4 _ZwWaitForWorkViaWorkerFactory@8 // _TppWaiterpThread@4 _ZwWaitForMultipleObjects@20 return 0; }
Chris Stankevitz 2014-07-15 00:04:
Hello,
When I run the following code on windows, some threads are created, presumably by winsock. These threads are "named" _TppWorkerThread. This does not happen on linux.
These threads do not stop when all the boost objects go out of scope, but I wish they did.
Q1: Am I doing something wrong?
Q2: Is there a boost way for me to stop these threads?
Hi, from: http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/overview/implementa... "An additional thread per io_service is used to emulate asynchronous host resolution. This thread is created on the first call to either ip::tcp::resolver::async_resolve() or ip::udp::resolver::async_resolve()." -- Regards, niXman ___________________________________________________ Dual-target(32 & 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows: http://sourceforge.net/projects/mingw-w64/ ___________________________________________________ Another online IDE: http://liveworkspace.org/
On Mon, Jul 14, 2014 at 1:08 PM, niXman
"An additional thread per io_service is used to emulate asynchronous host resolution. This thread is created on the first call to either ip::tcp::resolver::async_resolve() or ip::udp::resolver::async_resolve()."
niXman, Thank you. A literal interpretation of that page would lead me to believe my example program should create zero threads, whereas my example program creates three threads. I do not call async_resolve, I do not create timers, and I do not call async_connect (albeit I do call the synchronous resolve). However, at this point perhaps I should just stop going down the rabbit whole and consider this "expected behavior". Also, I will assume the answer to my my first and second questions are "no".
Q1: Am I doing something wrong?
Q2: Is there a boost way for me to stop these threads?
Thank you again, Chris
participants (2)
-
Chris Stankevitz
-
niXman