From 6fed6029be14e2932abaf7d8be03cc91cefd7fe3 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 10 May 2019 13:45:00 +0200 Subject: [PATCH] Minimal fix to avoid busy looping. The condition_variable varant showed spurious failures on travis so go for the minimial fix. --- pdns/communicator.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/communicator.cc b/pdns/communicator.cc index 7db5a3e5b6..7fd59e450e 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -136,7 +136,10 @@ void CommunicatorClass::mainloop(void) if (extraSlaveRefresh) slaveRefresh(&P); } - else { + else { + // eat up extra posts to avoid busy looping if many posts were done + while (d_any_sem.tryWait() == 0) { + } break; // something happened } // this gets executed at least once every second -- 2.47.2