P
Size: a a a
P
P
A
A
RN
P
P
A
P
A
A
void thread1()
{
while (1)
{
if (not_empty)
{
std::cout << q.front();
q.pop();
}
std::lock_guard lg{mtx};
if (q.empty()) not_empty = true;
}
}
void thread2()
{
while (1)
{
std::lock_guard lg{mtx};
q.push();
}
}
A
A
A
AB
AB
AB
A
xd