mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-18 05:32:27 -04:00
Avoid tight loop on lock file access failure
This commit is contained in:
parent
dacd534284
commit
f31a4efbee
7
main.cpp
7
main.cpp
@ -225,8 +225,7 @@ int main(int argc, char *argv[])
|
|||||||
// disallow multiple instances with same instance key
|
// disallow multiple instances with same instance key
|
||||||
QLockFile instance_lock {temp_dir.absoluteFilePath (a.applicationName () + ".lock")};
|
QLockFile instance_lock {temp_dir.absoluteFilePath (a.applicationName () + ".lock")};
|
||||||
instance_lock.setStaleLockTime (0);
|
instance_lock.setStaleLockTime (0);
|
||||||
bool lock_ok {false};
|
while (!instance_lock.tryLock ())
|
||||||
while (!(lock_ok = instance_lock.tryLock ()))
|
|
||||||
{
|
{
|
||||||
if (QLockFile::LockFailedError == instance_lock.error ())
|
if (QLockFile::LockFailedError == instance_lock.error ())
|
||||||
{
|
{
|
||||||
@ -249,6 +248,10 @@ int main(int argc, char *argv[])
|
|||||||
throw std::runtime_error {"Multiple instances must have unique rig names"};
|
throw std::runtime_error {"Multiple instances must have unique rig names"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw std::runtime_error {"Failed to access lock file"};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load UI translations
|
// load UI translations
|
||||||
|
Loading…
x
Reference in New Issue
Block a user