queue clear - operator=(&&)
This commit is contained in:
		@@ -95,8 +95,11 @@ public:
 | 
				
			|||||||
    // Clear the queue
 | 
					    // Clear the queue
 | 
				
			||||||
    void clear()
 | 
					    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:
 | 
					private:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,13 +80,6 @@ void testq(int size, int pushers, int poppers)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	active = true;			
 | 
						active = true;			
 | 
				
			||||||
	Q q{static_cast<Q::size_type>(size)};		
 | 
						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++)
 | 
						for(int i = 0; i < poppers; i++)
 | 
				
			||||||
		new std::thread(std::bind(popper, &q));
 | 
							new std::thread(std::bind(popper, &q));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user