mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 01:51:38 +08:00
queue clear - operator=(&&)
This commit is contained in:
parent
65e8349c60
commit
bb529a226d
@ -95,8 +95,11 @@ public:
|
||||
// Clear the queue
|
||||
void clear()
|
||||
{
|
||||
T item;
|
||||
while (pop(item, std::chrono::milliseconds(0)));
|
||||
{
|
||||
std::unique_lock<std::mutex> ul(mutex_);
|
||||
q_ = queue_t{};
|
||||
}
|
||||
item_popped_cond_.notify_all();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -70,7 +70,7 @@ void popper(Q* q)
|
||||
string output;
|
||||
while(active)
|
||||
{
|
||||
q->pop(output);
|
||||
q->pop(output);
|
||||
++pop_count;
|
||||
}
|
||||
}
|
||||
@ -80,13 +80,6 @@ void testq(int size, int pushers, int poppers)
|
||||
|
||||
active = true;
|
||||
Q q{static_cast<Q::size_type>(size)};
|
||||
/*
|
||||
A a;
|
||||
q.push(a);
|
||||
std::cout << "Befor pop..\n";
|
||||
q.pop(a);
|
||||
return;
|
||||
*/
|
||||
|
||||
for(int i = 0; i < poppers; i++)
|
||||
new std::thread(std::bind(popper, &q));
|
||||
|
Loading…
Reference in New Issue
Block a user