| | |
| | | bool ShmMsgQueue::Send(const MQId &remote_id, const Msg &msg, const int timeout_ms) |
| | | { |
| | | Queue *remote = find(MsgQIdToName(remote_id)); |
| | | |
| | | return remote && remote->Write(msg, timeout_ms); |
| | | |
| | | if(!remote) { |
| | | return false; |
| | |
| | | |
| | | bool ShmMsgQueue::Send(const MQId &remote_id, const void *data, const size_t size, const int timeout_ms) |
| | | { |
| | | // Test shows that in the 2 cases: |
| | | // 1) build msg first, then find remote queue; |
| | | // 2) find remote queue first, then build msg; |
| | | // 1 is about 50% faster than 2, maybe cache related. |
| | | |
| | | Msg msg; |
| | | if (msg.Build(shm(), Id(), data, size, false)) { |
| | | if (Send(remote_id, msg, timeout_ms)) { |