break
キューが空でない場合にループが実行されるループを作成していますが、ループの最後にa を含める必要があるかどうか疑問に思っていました。基本的に、各ループは、キューが空になるまで、キュー内のすべての要素に対して実行する必要があります。
では、次のうちどれを実行する必要がありますか。正しいことがあるかどうかはわかりません。
while (1)
{
/*process message from incoming queue*/
if (!msgs_inc.empty())
{
/*categorise incoming message into global map of outgoing messages*/
msgInfo current_msg = incMsgClassification(msgs_inc.front());
msgs_inc.pop();
clients_msg[current_msg.destID][current_msg.priorityLevel].push(current_msg);
}
}
また
while (1)
{
//Sleep(50000);
//cout << "success" << endl;
/*process message from incoming queue*/
if (!msgs_inc.empty())
{
/*categorise incoming message into global map of outgoing messages*/
msgInfo current_msg = incMsgClassification(msgs_inc.front());
msgs_inc.pop();
clients_msg[current_msg.destID][current_msg.priorityLevel].push(current_msg);
break;
}
}