Cleanup
This commit is contained in:
		
					parent
					
						
							
								91cb94d462
							
						
					
				
			
			
				commit
				
					
						7d172cfc3a
					
				
			
		
					 1 changed files with 20 additions and 19 deletions
				
			
		| 
						 | 
					@ -263,25 +263,7 @@ public:
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	value_type next ()
 | 
						value_type next ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		debug_assert (!empty ()); // Should be checked before calling next
 | 
							release_assert (!empty ()); // Should be checked before calling next
 | 
				
			||||||
 | 
					 | 
				
			||||||
		auto should_seek = [&, this] () {
 | 
					 | 
				
			||||||
			if (iterator == queues.end ())
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			auto & queue = iterator->second;
 | 
					 | 
				
			||||||
			if (queue.empty ())
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			// Allow up to `queue.priority` requests to be processed before moving to the next queue
 | 
					 | 
				
			||||||
			if (counter >= queue.priority)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (should_seek ())
 | 
							if (should_seek ())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					@ -312,6 +294,25 @@ public:
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
						bool should_seek () const
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (iterator == queues.end ())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							auto & queue = iterator->second;
 | 
				
			||||||
 | 
							if (queue.empty ())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							// Allow up to `queue.priority` requests to be processed before moving to the next queue
 | 
				
			||||||
 | 
							if (counter >= queue.priority)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void seek_next ()
 | 
						void seek_next ()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		counter = 0;
 | 
							counter = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue