| | |
| | | |
| | | namespace { |
| | | std::string MsgQIdToName(const MQId& id) { return "shmq" + to_string(id); } |
| | | MQId EmptyId() { return nil_uuid(); } |
| | | // MQId EmptyId() { return nil_uuid(); } |
| | | MQId NewId() { return random_generator()(); } |
| | | const int AdjustMQLength(const int len) { |
| | | const int kMaxLength = 10000; |
| | |
| | | Remove(); |
| | | } |
| | | |
| | | bool ShmMsgQueue::Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms) |
| | | bool ShmMsgQueue::Send(SharedMemory &shm, const MQId &remote_id, const MsgI &msg, const int timeout_ms) |
| | | { |
| | | Queue *remote = find(MsgQIdToName(remote_id)); |
| | | Queue *remote = Find(shm, MsgQIdToName(remote_id)); |
| | | return remote && remote->Write(msg, timeout_ms, [](const MsgI&msg){msg.AddRef();}); |
| | | } |
| | | |
| | | // bool ShmMsgQueue::Send(const MQId &remote_id, const MsgI &msg, const int timeout_ms) |
| | | // { |
| | | // Queue *remote = Find(MsgQIdToName(remote_id)); |
| | | // return remote && remote->Write(msg, timeout_ms, [](const MsgI&msg){msg.AddRef();}); |
| | | // } |
| | | |
| | | bool ShmMsgQueue::Send(const MQId &remote_id, const BHMsg &data, const int timeout_ms) |
| | | { |
| | | MsgI msg; |