mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-29 16:40:48 +08:00
update
This commit is contained in:
@@ -5,11 +5,6 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <boost/noncopyable.hpp>
|
||||
//#include <boost/shared_ptr.hpp>
|
||||
//#include <stdexcept>
|
||||
//#include <boost/thread/thread.hpp>
|
||||
//#include <boost/bind.hpp>
|
||||
//#include <boost/shared_ptr.hpp>
|
||||
|
||||
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<std::shared_ptr<std::thread>> 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>msgpack/include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>msgpack/include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
||||
+4
-1
@@ -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<std::mutex> lock(mtx_);
|
||||
@@ -98,6 +100,7 @@ class rpc_server : private boost::noncopyable {
|
||||
std::mutex mtx_;
|
||||
std::shared_ptr<std::thread> check_thread_;
|
||||
size_t check_seconds_;
|
||||
bool stop_check_ = false;
|
||||
};
|
||||
} // namespace rpc_service
|
||||
} // namespace rest_rpc
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\msgpack\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\msgpack\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
||||
Reference in New Issue
Block a user