12345678910111213141516171819202122232425262728293031323334353637 |
- #include <QCoreApplication>
- //#include "mainwindow.h"
- #include "databoardcore.h"
- #include "../ytDashBoardDog/dataprecess.h"
- #include "databoardmem.h"
- YtDashBoardShm *dataProcessShm;
- YtStationCount *ytStationCount;
- bool load_shm(){
- int shmid;
- key_t key;
- if((key = ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(YtDashBoardShm),IPC_CREAT|0666))==-1)
- return false;
- dataProcessShm = static_cast<YtDashBoardShm *>(shmat(shmid,nullptr,0));
- if((key = ftok(MEM_PATH, static_cast<int>(MEM_PORT)))==-1)
- return false;
- if((shmid = shmget(key, sizeof (YtStationCount), IPC_CREAT|0666))==-1)
- return false;
- printf("****************shmid = %d",shmid);
- ytStationCount = static_cast<YtStationCount *>(shmat(shmid, nullptr, 0));
- return true;
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- if(load_shm()){
- DataBoardCore *core = new DataBoardCore(nullptr);
- core->start();
- }else
- exit(1);
- return a.exec();
- }
|