From: Remi Gacogne Date: Tue, 30 Mar 2021 08:23:08 +0000 (+0200) Subject: speedtest: Move the increment inside the loop for lock tests X-Git-Tag: dnsdist-1.6.0-rc1~42^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10216%2Fhead;p=thirdparty%2Fpdns.git speedtest: Move the increment inside the loop for lock tests --- diff --git a/pdns/speedtest.cc b/pdns/speedtest.cc index 078acd058c..80702f2800 100644 --- a/pdns/speedtest.cc +++ b/pdns/speedtest.cc @@ -872,9 +872,8 @@ struct ReadWriteLockSharedTest string getName() const { return "RW lock shared"; } void operator()() const { - for (size_t idx = 0; idx < 1000; ) { + for (size_t idx = 0; idx < 1000; idx++) { ReadLock wl(d_lock); - ++idx; } } @@ -891,9 +890,8 @@ struct ReadWriteLockExclusiveTest string getName() const { return "RW lock exclusive"; } void operator()() const { - for (size_t idx = 0; idx < 1000; ) { + for (size_t idx = 0; idx < 1000; idx++) { WriteLock wl(d_lock); - ++idx; } } @@ -910,7 +908,7 @@ struct ReadWriteLockExclusiveTryTest string getName() const { return "RW lock try exclusive - " + std::string(d_contended ? "contended" : "non-contended"); } void operator()() const { - for (size_t idx = 0; idx < 1000; ) { + for (size_t idx = 0; idx < 1000; idx++) { TryWriteLock wl(d_lock); if (!wl.gotIt() && !d_contended) { cerr<<"Error getting the lock"<