From: Otto Moerbeek Date: Fri, 10 May 2019 11:45:00 +0000 (+0200) Subject: Minimal fix to avoid busy looping. The condition_variable varant showed X-Git-Tag: auth-4.1.9~4^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F7829%2Fhead;p=thirdparty%2Fpdns.git Minimal fix to avoid busy looping. The condition_variable varant showed spurious failures on travis so go for the minimial fix. --- 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