| | |
| | | #ifndef SHM_MSG_QUEUE_D847TQXH |
| | | #define SHM_MSG_QUEUE_D847TQXH |
| | | |
| | | #include "defs.h" |
| | | #include "msg.h" |
| | | #include "shm_queue.h" |
| | | |
| | |
| | | |
| | | #define BH_USE_ATOMIC_Q |
| | | |
| | | class ShmMsgQueue : public StaticDataRef<std::atomic<uint64_t>, ShmMsgQueue> |
| | | class ShmMsgQueue |
| | | { |
| | | public: |
| | | typedef int64_t RawData; |
| | |
| | | typedef Shmq::Data Queue; |
| | | typedef Shmq::ShmType ShmType; |
| | | typedef uint64_t MQId; |
| | | |
| | | static MQId NewId(); |
| | | |
| | | ShmMsgQueue(ShmType &segment, const MQId id, const int len); |
| | | ShmMsgQueue(ShmType &segment, const bool create_or_else_find, const MQId id, const int len); |
| | |
| | | bool Recv(MsgI &msg, const int timeout_ms) { return Recv(msg.OffsetRef(), timeout_ms); } |
| | | bool TryRecv(MsgI &msg) { return TryRecv(msg.OffsetRef()); } |
| | | static Queue *Find(ShmType &shm, const MQId remote); |
| | | static bool TrySend(ShmType &shm, const MQId remote, const RawData val); |
| | | bool TrySend(const MQId remote, const RawData val) { return TrySend(shm(), remote, val); } |
| | | static bool TrySend(ShmType &shm, const MQInfo &remote, const RawData val); |
| | | bool TrySend(const MQInfo &remote, const RawData val) { return TrySend(shm(), remote, val); } |
| | | |
| | | private: |
| | | #ifndef BH_USE_ATOMIC_Q |