From 11f6c600e55ca5677f93624efe44d2605cdd908d Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期五, 21 五月 2021 20:18:38 +0800 Subject: [PATCH] reserve #,@ prefix for internal proc id and topic. --- src/shm_msg_queue.cpp | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/shm_msg_queue.cpp b/src/shm_msg_queue.cpp index 663da1e..be2d2a2 100644 --- a/src/shm_msg_queue.cpp +++ b/src/shm_msg_queue.cpp @@ -31,12 +31,6 @@ } // namespace -ShmMsgQueue::MQId ShmMsgQueue::NewId() -{ - static auto &id = GetData(); - return (++id) * 10; -} - ShmMsgQueue::ShmMsgQueue(ShmType &segment, const MQId id, const int len) : id_(id), queue_(segment, MsgQIdToName(id_), len, segment.get_segment_manager()) @@ -84,7 +78,7 @@ if (IsCmd(val)) { LOG_DEBUG() << "clsing queue " << id << ", has a cmd" << DecodeCmd(val); } else { - MsgI(val).Release(); + MsgI(val, shm).Release(); } } } @@ -96,11 +90,11 @@ return Shmq::Find(shm, MsgQIdToName(remote_id)); } -bool ShmMsgQueue::TrySend(SharedMemory &shm, const MQId remote, int64_t val) +bool ShmMsgQueue::TrySend(SharedMemory &shm, const MQInfo &remote, const RawData val) { try { //TODO find from center, or use offset. - ShmMsgQueue dest(shm, false, remote, 1); + ShmMsgQueue dest(remote.offset_, shm, remote.id_); #ifndef BH_USE_ATOMIC_Q Guard lock(GetMutex(remote_id)); #endif -- Gitblit v1.8.0