Skip to content
Snippets Groups Projects
Unverified Commit 38ca7b85 authored by Adrien Béraud's avatar Adrien Béraud Committed by GitHub
Browse files

Merge pull request #267 from AmarOk1412/cpuusage

scheduler: avoid overflow causing 100% cpu usage
parents d9f6731d 62bbce76
No related branches found
No related tags found
No related merge requests found
...@@ -124,6 +124,9 @@ DhtProxyServer::DhtProxyServer(std::shared_ptr<DhtRunner> dht, in_port_t port , ...@@ -124,6 +124,9 @@ DhtProxyServer::DhtProxyServer(std::shared_ptr<DhtRunner> dht, in_port_t port ,
while (service_->is_up() and not stopListeners) { while (service_->is_up() and not stopListeners) {
std::unique_lock<std::mutex> lock(schedulerLock_); std::unique_lock<std::mutex> lock(schedulerLock_);
auto next = scheduler_.run(); auto next = scheduler_.run();
if (next == time_point::max())
schedulerCv_.wait(lock);
else
schedulerCv_.wait_until(lock, next); schedulerCv_.wait_until(lock, next);
} }
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment