lichao
2021-03-29 f51636c193d032723c47343e39ff8296db350200
src/shm_queue.h
@@ -102,12 +102,12 @@
using namespace bhome_msg;
class ShmMsgQueue : private ShmObject<SharedQueue<Msg> >
class ShmMsgQueue : private ShmObject<SharedQueue<MsgI> >
{
    typedef ShmObject<SharedQueue<Msg> > Super;
    typedef ShmObject<SharedQueue<MsgI> > Super;
    typedef Super::Data Queue;
    bool Write(const Msg &buf, const int timeout_ms) { return data()->Write(buf, timeout_ms); }
    bool Read(Msg &buf, const int timeout_ms) { return data()->Read(buf, timeout_ms); }
    bool Write(const MsgI &buf, const int timeout_ms) { return data()->Write(buf, timeout_ms); }
    bool Read(MsgI &buf, const int timeout_ms) { return data()->Read(buf, timeout_ms); }
    MQId id_;
protected:
    ShmMsgQueue(const std::string &raw_name, ShmType &segment, const int len); // internal use.
@@ -115,11 +115,11 @@
    ShmMsgQueue(const MQId &id, ShmType &segment, const int len);
    ShmMsgQueue(ShmType &segment, const int len);
    ~ShmMsgQueue();
    bool Send(const MQId &remote_id, const void *data, const size_t size, const int timeout_ms);
    bool Recv(MQId &source_id, void *&data, size_t &size, const int timeout_ms);
    // bool Send(const MQId &remote_id, const void *data, const size_t size, const int timeout_ms); // request
    bool Recv(BHMsg &msg, const int timeout_ms);
    bool Send(const MQId &remote_id, const BHMsg &msg, const int timeout_ms);
    const MQId &Id() const { return id_; }
    bool Send(const MQId &remote_id, const Msg &msg, const int timeout_ms);
    bool Recv(Msg &msg, const int timeout_ms) { return Read(msg, timeout_ms); }
    bool Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms);
};
} // namespace bhome_shm