qicosmos / rest_rpc

modern C++(C++11), simple, easy to use rpc framework
MIT License
1.66k stars 365 forks source link

rpc_server takes 15sec when exit.... #4

Open objects76 opened 5 years ago

objects76 commented 5 years ago

When rpc_server shutdown, it takes 15 sec(checkseconds value) at worst case.

So,... How about using condition_variable wait for instead of this_thread::sleep.

`~rpc_server() { stopcheck = true; cleansig.notify_one(); checkthread->join();

void clean() { while (!stopcheck) { //std::this_thread::sleep_for(std::chrono::seconds(checkseconds)); std::uniquelock lock(mtx); cleansig.wait_for(lock, std::chrono::seconds(checkseconds));`

qicosmos commented 5 years ago

That's true. Feel free to make a pr.

qicosmos commented 4 years ago

I have solved the problem, no need waiting 15 seconds any more.