| | |
| | | |
| | | ShmMsgQueue::MQId ShmMsgQueue::NewId() |
| | | { |
| | | static auto &id = GetData(); |
| | | static auto &id = GetData("Must init shared memory before use! Please make sure center is running."); |
| | | return (++id) * 10; |
| | | } |
| | | |
| | |
| | | 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 |