From 37f625b0af0b5e818de97b83dd96709df118ad6b Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Sun, 11 Sep 2022 13:31:02 +0200 Subject: [PATCH] auth LUA records: we only need one IsUpOracle checker thread --- pdns/lua-record.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 16ad0b9e70..c13373b79f 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -76,7 +76,7 @@ private: }; public: - IsUpOracle() + IsUpOracle(): d_checkerThreadStarted(ATOMIC_FLAG_INIT) { } ~IsUpOracle() @@ -203,6 +203,7 @@ private: SharedLockGuarded d_statuses; std::unique_ptr d_checkerThread; + std::atomic_flag d_checkerThreadStarted; void setStatus(const CheckDesc& cd, bool status) { @@ -240,7 +241,7 @@ private: bool IsUpOracle::isUp(const CheckDesc& cd) { - if (!d_checkerThread) { + if (!d_checkerThreadStarted.test_and_set()) { d_checkerThread = std::make_unique([this] { return checkThread(); }); } time_t now = time(nullptr); -- 2.47.2