mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Merge pull request #5062 from FearlessTobi/port-3173
Port yuzu-emu/yuzu#3173: "common: SPSCQueue: Notify after incrementing queue size."
This commit is contained in:
		
						commit
						b53b4bfb17
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -46,8 +46,15 @@ public: | |||
|         ElementPtr* new_ptr = new ElementPtr(); | ||||
|         write_ptr->next.store(new_ptr, std::memory_order_release); | ||||
|         write_ptr = new_ptr; | ||||
|         ++size; | ||||
| 
 | ||||
|         const size_t previous_size{size++}; | ||||
| 
 | ||||
|         // Acquire the mutex and then immediately release it as a fence.
 | ||||
|         // TODO(bunnei): This can be replaced with C++20 waitable atomics when properly supported.
 | ||||
|         // See discussion on https://github.com/yuzu-emu/yuzu/pull/3173 for details.
 | ||||
|         if (previous_size == 0) { | ||||
|             std::lock_guard lock{cv_mutex}; | ||||
|         } | ||||
|         cv.notify_one(); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue