本文整理汇总了C++中MessageQueue::GetTheirSerialNum方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageQueue::GetTheirSerialNum方法的具体用法?C++ MessageQueue::GetTheirSerialNum怎么用?C++ MessageQueue::GetTheirSerialNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageQueue
的用法示例。
在下文中一共展示了MessageQueue::GetTheirSerialNum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterCallback
bool MessageEndpoint::RegisterCallback(Ticket &outTicket)
{
//Only one thread in this function at a time
Lock lock(&m_callbackRegisterMutex);
{
uint32_t nextSerial;
{
//Protection for the m_callbackDoWakeup bool
Lock condLock(&m_availableCBsMutex);
//TODO: Unprotected read of byte value m_isShutdown. Probably safe though.
while(m_availableCBs.empty() && !m_isShutDown)
{
pthread_cond_wait(&m_callbackWakeupCondition, &m_availableCBsMutex);
}
if(m_isShutDown)
{
return false;
}
//This is the first message of the protocol. This message contains the serial number we will be expecting later
nextSerial = m_availableCBs.front();
m_availableCBs.pop();
}
outTicket.m_isCallback = true;
outTicket.m_hasInit = true;
outTicket.m_ourSerialNum = nextSerial;
outTicket.m_socketFD = m_socketFD;
MessageQueue *queue = m_queues.GetByOurSerial(nextSerial);
if(queue == NULL)
{
outTicket.m_theirSerialNum = 0;
}
else
{
outTicket.m_theirSerialNum = queue->GetTheirSerialNum();
}
}
return true;
}