本文整理汇总了C++中MessageQueue::push方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageQueue::push方法的具体用法?C++ MessageQueue::push怎么用?C++ MessageQueue::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageQueue
的用法示例。
在下文中一共展示了MessageQueue::push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Sender
void Sender(MessageQueue& queue, long& sent)
{
Safir::Dob::MessagePtr m = Safir::Dob::Message::Create();
Safir::Dob::Typesystem::BinarySerialization ser;
Safir::Dob::Typesystem::Serialization::ToBinary(m,ser);
DistributionData d(message_tag,ConnectionId(100,0,100),Safir::Dob::Typesystem::ChannelId(),&ser[0]);
lllog(1) << "Push loop starting (in thread)" << std::endl;
for (;;)
{
if (sent == NUM_MSG)
{
return;
}
const bool res = queue.push(d);
if (res)
{
++sent;
}
else
{
boost::this_thread::yield();
continue;
}
if (sent % 100 == 1)
{
lllog(1) << sent << " sent" << std::endl;
}
}
}
示例2: min
void TotalOrderBroadcastSimulator<BroadcastPolicy>::updateWaitingForAcksList(int receiver, Message m) {
MessageQueue bkp;
while(!waitingForAcks[receiver].empty()) {
Message msg = waitingForAcks[receiver].top();
waitingForAcks[receiver].pop();
if(m.getId() == msg.getId()) {
if(msg.content != 'A') {
//cout << "Updating content for " << msg.getId() << " with " << msg.content << endl;
m.content = msg.content;
}
m.time = min(m.time, msg.time);
}
else bkp.push(msg);
}
waitingForAcks[receiver] = bkp;
waitingForAcks[receiver].push(m);
}