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; } } }
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); }