Shm.hpp
1 //
2 // Created by xiong on 2022/6/9.
3 //
4 
5 #ifndef EMX_Shm_HPP
6 #define EMX_Shm_HPP
7 
8 #include <cstdint>
9 
10 namespace Emx {
16  class Shm {
17  public:
18  Shm() {
19  m_shmId = -1;
20  m_shmPtr = nullptr;
21  }
22 
23  ~Shm() {
24  Destroy();
25  }
26 
33  void *Create(int key, int32_t size = 0);
34 
36  void Destroy();
37 
39  int32_t GetSize();
40 
41  private:
42  int m_shmId;
43  void *m_shmPtr;
44  };
46 }
47 
48 #endif //EMX_Shm_HPP
用于共享内存
Definition: Shm.hpp:16
void * Create(int key, int32_t size=0)
创建或获取共享内存
void Destroy()
断开共享内存
Shm()
Definition: Shm.hpp:18
~Shm()
Definition: Shm.hpp:23
int32_t GetSize()
获取共享内存大小
Definition: EmxGpio.hpp:10