https://blog.youkuaiyun.com/weixin_44450715/article/details/86314193
上一篇說完了shared memory篇後,也要把餘下的Intra 和 rtps 篇給補完了
Intra 模式
先說重點,Intra模式不是做多進程通訊的,而是做單進程內部通訊的。
而其架構基本就是把shared memory版本中的所有shared memory操作,線程安全的代碼去掉就是了。
所以一定要先看上一篇
簡單看一下其IntraDispatcher
和IntraTransmitter
就會明白了(IntraReceiver
的實現和ShmReceiver
是一樣的)
// IntraDispatcher
template <typename MessageT>
void IntraDispatcher::OnMessage(uint64_t channel_id,
const std::shared_ptr<MessageT>& message,
const MessageInfo& message_info) {
if (is_shutdown_.load()) {
return;
}
ADEBUG << "intra on message, channel:"
<< common::GlobalData::GetChannelById(channel_id);
ListenerHandlerBasePtr* handler_base = nullptr;
if (msg_listeners_.Get(channel_id, &handler_base)) {
if ((*handler_base)->IsR