From 844c090f72e024f9fd9773f68e5cb0acd6682924 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 30 Mar 2021 10:23:08 +0200 Subject: [PATCH] speedtest: Move the increment inside the loop for lock tests --- pdns/speedtest.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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"<