File: shmem.cpp

package info (click to toggle)
wsjtx 2.6.1%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 69,664 kB
  • sloc: cpp: 86,977; f90: 42,417; python: 27,241; ansic: 12,510; fortran: 2,382; makefile: 197; sh: 134
file content (20 lines) | stat: -rwxr-xr-x 698 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <QSharedMemory>
#include <QLatin1String>

// Multiple instances: KK1D, 17 Jul 2013
QSharedMemory shmem;

struct jt9com;

// C wrappers for a QSharedMemory class instance
extern "C"
{
  bool shmem_create (int nsize) {return shmem.create(nsize);}
  void shmem_setkey (char * const mykey) {shmem.setKey(QLatin1String{mykey});}
  bool shmem_attach () {return shmem.attach();}
  int shmem_size () {return static_cast<int> (shmem.size());}
  struct jt9com * shmem_address () {return reinterpret_cast<struct jt9com *>(shmem.data());}
  bool shmem_lock () {return shmem.lock();}
  bool shmem_unlock () {return shmem.unlock();}
  bool shmem_detach () {return shmem.detach();}
}