Tigher loop in KeepAlive; skip syscalls if overloaded
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include "index.h"
|
||||
@@ -17,7 +18,11 @@ class KeepAlive {
|
||||
private:
|
||||
const std::chrono::nanoseconds max_stale_;
|
||||
Index* index_;
|
||||
int shutdown_;
|
||||
|
||||
// Two shutdown mechanisms, one for if we're in a tight no-syscall loop,
|
||||
// and one for if we're sleeping in poll()
|
||||
int shutdown_fd_;
|
||||
std::atomic<bool> running_ = true;
|
||||
|
||||
std::thread thread_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user