Disallow multiple instances without a unique rig name

Because of confilicts using the  shared memory to communicate with jt9
only one instance of WSJT-X may run with each unique key (rig name).

Added a QLockFile for each unique  key in the temp directory and logic
to deal with stale locks and retries.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4465 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2014-10-03 16:07:43 +00:00
parent d51594ec3f
commit 8d3c86c399
5 changed files with 51 additions and 28 deletions
+4 -5
View File
@@ -68,14 +68,14 @@ private:
};
//--------------------------------------------------- MainWindow constructor
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem, QString const& thekey,
unsigned downSampleFactor, bool test_mode, QWidget *parent) :
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem,
unsigned downSampleFactor, QWidget *parent) :
QMainWindow(parent),
m_revision {revision ("$Rev$")},
m_multiple {multiple},
m_settings (settings),
ui(new Ui::MainWindow),
m_config (thekey, settings, test_mode, this),
m_config (settings, this),
m_wideGraph (new WideGraph (settings)),
m_logDlg (new LogQSO (program_title (), settings, &m_config, this)),
m_dialFreq {0},
@@ -85,7 +85,6 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
m_diskData {false},
m_appDir {QApplication::applicationDirPath ()},
mem_jt9 {shdmem},
mykey_jt9 {thekey},
psk_Reporter (new PSK_Reporter (this)),
m_msAudioOutputBuffered (0u),
m_framesAudioInputBuffered (RX_SAMPLE_RATE / 10),
@@ -369,7 +368,7 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
lockFile.open(QIODevice::ReadWrite);
QStringList jt9_args {
"-s", mykey_jt9
"-s", QApplication::applicationName ()
, "-e", QDir::toNativeSeparators (m_appDir)
, "-a", QDir::toNativeSeparators (m_config.data_path ().absolutePath ())
};