diff --git a/io_service_pool.h b/io_service_pool.h index dcb4ed3..72f8b35 100644 --- a/io_service_pool.h +++ b/io_service_pool.h @@ -5,11 +5,6 @@ #include #include #include -//#include -//#include -//#include -//#include -//#include namespace rest_rpc { namespace rpc_service { @@ -26,8 +21,6 @@ class io_service_pool : private boost::noncopyable { } } - ~io_service_pool() { stop(); } - void run() { std::vector> threads; for (std::size_t i = 0; i < io_services_.size(); ++i) { @@ -41,7 +34,6 @@ class io_service_pool : private boost::noncopyable { void stop() { for (std::size_t i = 0; i < io_services_.size(); ++i) { io_services_[i]->stop(); - io_services_[i]->reset(); } } diff --git a/rest_rpc.vcxproj b/rest_rpc.vcxproj index 115de49..4988364 100644 --- a/rest_rpc.vcxproj +++ b/rest_rpc.vcxproj @@ -75,6 +75,9 @@ msgpack/include;$(IncludePath) + + msgpack/include;$(IncludePath) + Level3 diff --git a/rpc_server.h b/rpc_server.h index a605e0e..750e1cf 100644 --- a/rpc_server.h +++ b/rpc_server.h @@ -26,6 +26,8 @@ class rpc_server : private boost::noncopyable { } ~rpc_server() { + stop_check_ = true; + check_thread_->join(); io_service_pool_.stop(); thd_->join(); } @@ -68,7 +70,7 @@ class rpc_server : private boost::noncopyable { } void clean() { - while (true) { + while (!stop_check_) { std::this_thread::sleep_for(std::chrono::seconds(check_seconds_)); std::unique_lock lock(mtx_); @@ -98,6 +100,7 @@ class rpc_server : private boost::noncopyable { std::mutex mtx_; std::shared_ptr check_thread_; size_t check_seconds_; + bool stop_check_ = false; }; } // namespace rpc_service } // namespace rest_rpc diff --git a/test_client/test_client.vcxproj b/test_client/test_client.vcxproj index b23506f..d355e2c 100644 --- a/test_client/test_client.vcxproj +++ b/test_client/test_client.vcxproj @@ -72,6 +72,9 @@ ..\msgpack\include;$(IncludePath) + + ..\msgpack\include;$(IncludePath) + Level3