| | |
| | | #include "proto.h" |
| | | #include "shm.h" |
| | | #include <atomic> |
| | | #include <boost/interprocess/offset_ptr.hpp> |
| | | #include <functional> |
| | | #include <stdint.h> |
| | | |
| | | class ShmSocket; |
| | |
| | | |
| | | public: |
| | | RefCount() : |
| | | num_(1) { static_assert(std::is_pod<decltype(num_)>::value); } |
| | | num_(1) { } |
| | | // num_(1) { static_assert(std::is_pod<decltype(num_)>::value); } |
| | | int Inc() { return ++num_; } |
| | | int Dec() { return --num_; } |
| | | int Get() { return num_.load(); } |
| | |
| | | |
| | | private: |
| | | Meta *meta() const { return get<Meta>() - 1; } |
| | | |
| | | typedef std::function<void(void *p, int len)> ToArray; |
| | | |
| | | template <class Body> |
| | | void *Pack(const BHMsgHead &head, const uint32_t head_len, const Body &body, const uint32_t body_len) |