Wrong version of ipcomm.cpp was saved?

Running multiple instances now checked out in Linux, as well as Windows.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3496 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-07-19 00:44:48 +00:00
parent fb7948a836
commit f932f2a1da
2 changed files with 18 additions and 3 deletions

View File

@ -1,9 +1,13 @@
#include <QDebug> #include <QDebug>
#include <qsharedmemory.h> #include <QString>
#include <QSharedMemory>
#include <QSystemSemaphore> #include <QSystemSemaphore>
// Multiple instances: KK1D, 17 Jul 2013 // Multiple instances: KK1D, 17 Jul 2013
QSharedMemory mem_jt9("mem_jt9"); QSharedMemory mem_jt9;
// Semaphore not changed, as the acquire/release calls do not
// appear to be used anywhere.
QSystemSemaphore sem_jt9("sem_jt9", 1, QSystemSemaphore::Open); QSystemSemaphore sem_jt9("sem_jt9", 1, QSystemSemaphore::Open);
extern "C" { extern "C" {
@ -14,6 +18,8 @@ extern "C" {
bool unlock_jt9_(); bool unlock_jt9_();
char* address_jt9_(); char* address_jt9_();
int size_jt9_(); int size_jt9_();
// Multiple instances: wrapper for QSharedMemory::setKey()
bool setkey_jt9_(char* mykey, int mykey_len);
bool acquire_jt9_(); bool acquire_jt9_();
bool release_jt9_(); bool release_jt9_();
@ -31,5 +37,14 @@ bool unlock_jt9_() {return mem_jt9.unlock();}
char* address_jt9_() {return (char*)mem_jt9.constData();} char* address_jt9_() {return (char*)mem_jt9.constData();}
int size_jt9_() {return (int)mem_jt9.size();} int size_jt9_() {return (int)mem_jt9.size();}
// Multiple instances:
bool setkey_jt9_(char* mykey, int mykey_len) {
char *tempstr = (char *)calloc(mykey_len+1,1);
memset(tempstr, 0, mykey_len+1);
strncpy(tempstr, mykey, mykey_len);
QString s1 = QString(QLatin1String(tempstr));
mem_jt9.setKey(s1);
return true;}
bool acquire_jt9_() {return sem_jt9.acquire();} bool acquire_jt9_() {return sem_jt9.acquire();}
bool release_jt9_() {return sem_jt9.release();} bool release_jt9_() {return sem_jt9.release();}

View File

@ -1,4 +1,4 @@
//-------------------------------------------------------------- MainWindow //------------------------------------------------------------- MainWindow
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "devsetup.h" #include "devsetup.h"