diff options
author | Itay Grudev <itay+git2020@grudev.com> | 2020-09-09 02:29:00 +0100 |
---|---|---|
committer | Itay Grudev <itay+git2020@grudev.com> | 2020-09-09 02:29:00 +0100 |
commit | be013eff5cdfd840880b5989f35f1542af615d16 (patch) | |
tree | fc3259f3f3f9499adaa487a5631a6188d29db80a | |
parent | Improved the connectToPrimary() method and fixed issue with instanceStarted()... (diff) | |
download | singleapplication-be013eff5cdfd840880b5989f35f1542af615d16.tar.xz |
Mitigated QSharedMemory initialization failures
Mitigated QSharedMemory initialization failures due to large amount of processes attempting to get hold of the shared memory block at the same time
-rw-r--r-- | singleapplication.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/singleapplication.cpp b/singleapplication.cpp index d369aa1..0791096 100644 --- a/singleapplication.cpp +++ b/singleapplication.cpp @@ -55,6 +55,10 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda // block and QLocalServer d->genBlockServerName(); + // To mitigate QSharedMemory issues with large amount of processes + // attempting to attach at the same time + d->randomSleep(); + #ifdef Q_OS_UNIX // By explicitly attaching it and then deleting it we make sure that the // memory is deleted even after the process has crashed on Unix. |