TreeFrogFramework  2.8
tsharedmemory.h
Go to the documentation of this file.
1 #pragma once
2 #include <TGlobal>
3 #ifdef Q_OS_WIN
4 #include <QSharedMemory>
5 #endif
6 
8 #ifdef Q_OS_WIN
9  : public QSharedMemory
10 #endif
11 {
12 public:
13  TSharedMemory(const QString &name);
14  ~TSharedMemory();
15  bool create(size_t size);
16  void unlink();
17  bool attach();
18  bool detach();
19 
20  void *data();
21  const void *data() const;
22  QString name() const;
23  size_t size() const;
24 
25  bool lockForRead();
26  bool lockForWrite();
27  bool unlock();
28 
29 private:
30 #ifndef Q_OS_WIN
31  QString _name;
32  size_t _size {0};
33  void *_ptr {nullptr};
34  int _fd {0};
35 #endif
36 
39 };
The TSharedMemory class provides access to a shared memory segment.
Definition: tsharedmemory.h:11
#define T_CORE_EXPORT
Definition: tdeclexport.h:28
#define T_DISABLE_COPY(Class)
Definition: tdeclexport.h:37
#define T_DISABLE_MOVE(Class)
Definition: tdeclexport.h:41