From 08ce90c113c99fa16722137722092ebd5dab0ae1 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 23 Jun 2021 15:07:22 +0300 Subject: [PATCH] kdecore: use usleep() instead of select() in KLockFile::lock() Signed-off-by: Ivailo Monev --- kdecore/io/klockfile_unix.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/kdecore/io/klockfile_unix.cpp b/kdecore/io/klockfile_unix.cpp index b8ee9b0b..77a90f68 100644 --- a/kdecore/io/klockfile_unix.cpp +++ b/kdecore/io/klockfile_unix.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -47,9 +48,6 @@ #include "kde_file.h" #include "kfilesystemtype_p.h" -#include -#include - // Related reading: // http://www.spinnaker.de/linux/nfs-locking.html // http://en.wikipedia.org/wiki/File_locking @@ -453,14 +451,7 @@ KLockFile::LockResult KLockFile::lock(LockFlags options) break; } - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = n*((KRandom::random() % 200)+100); - if (n < 2000) { - n = n * 2; - } - - select(0, 0, 0, 0, &tv); + ::usleep((KRandom::random() % 1000) + 200); } if (result == LockOK) { d->isLocked = true;