mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdecore: use usleep() instead of select() in KLockFile::lock()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
934a74c881
commit
08ce90c113
1 changed files with 2 additions and 11 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
|
@ -47,9 +48,6 @@
|
|||
#include "kde_file.h"
|
||||
#include "kfilesystemtype_p.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
// 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue