void RobotManager::MakeChannel(xhn::static_string sender, xhn::static_string receiver) { xhn::RWLock2::Instance inst = m_readwriteLock.GetWriteLock(); RobotMap::iterator s = m_robotMap.find(sender); if (s == m_robotMap.end()) return; RobotMap::iterator r = m_robotMap.find(receiver); if (r == m_robotMap.end()) return; ////////////////////////////////////////////////////////////////////////// Robot* sRob = s->second; Robot::ChannelMap::iterator iter = sRob->m_commandTransmissionChannels.find(receiver); RWBuffer channel = NULL; if (iter != sRob->m_commandTransmissionChannels.end()) channel = iter->second; else { channel = RWBuffer_new(1024 * 1024); sRob->m_commandTransmissionChannels.insert( xhn::make_pair(receiver, channel) ); } ////////////////////////////////////////////////////////////////////////// Robot* rRob = r->second; iter = rRob->m_commandReceivingChannels.find(sender); if (iter != rRob->m_commandReceivingChannels.end()) return; else rRob->m_commandReceivingChannels.insert( xhn::make_pair(sender, channel) ); }
///**********************************************************************/// /// class implement begin /// ///**********************************************************************/// SafedBuffer::SafedBuffer(euint bufferSize) : m_nonblockingCount(0) , m_blockingCount(0) { euint size = GetRealSize(euint, bufferSize); m_transferBuffer = (char*)Malloc(size); m_buffer = RWBuffer_new(bufferSize); }
void InputListener::Init() { m_input_buffer = RWBuffer_new(1024 * sizeof(input_event)); m_read_buffer = (input_event*)SMalloc(1024 * sizeof(input_event) * 2); }