lichao
2021-05-21 11f6c600e55ca5677f93624efe44d2605cdd908d
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