mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	general: Use deducation guides for std::lock_guard and std::unique_lock
Since C++17, the introduction of deduction guides for locking facilities means that we no longer need to hardcode the mutex type into the locks themselves, making it easier to switch mutex types, should it ever be necessary in the future.
This commit is contained in:
		
							parent
							
								
									d5bcb45b2a
								
							
						
					
					
						commit
						21c71d21ae
					
				
					 21 changed files with 124 additions and 122 deletions
				
			
		|  | @ -165,7 +165,7 @@ void Client::OnPadData(Response::PadData data) { | |||
|     Common::Vec3f accel = Common::MakeVec<float>(-data.accel.x, data.accel.y, -data.accel.z); | ||||
|     Common::Vec3f gyro = Common::MakeVec<float>(-data.gyro.pitch, -data.gyro.yaw, data.gyro.roll); | ||||
|     { | ||||
|         std::lock_guard<std::mutex> guard(status->update_mutex); | ||||
|         std::lock_guard guard(status->update_mutex); | ||||
| 
 | ||||
|         status->motion_status = {accel, gyro}; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class UDPTouchDevice final : public Input::TouchDevice { | |||
| public: | ||||
|     explicit UDPTouchDevice(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {} | ||||
|     std::tuple<float, float, bool> GetStatus() const { | ||||
|         std::lock_guard<std::mutex> guard(status->update_mutex); | ||||
|         std::lock_guard guard(status->update_mutex); | ||||
|         return status->touch_status; | ||||
|     } | ||||
| 
 | ||||
|  | @ -27,7 +27,7 @@ class UDPMotionDevice final : public Input::MotionDevice { | |||
| public: | ||||
|     explicit UDPMotionDevice(std::shared_ptr<DeviceStatus> status_) : status(std::move(status_)) {} | ||||
|     std::tuple<Common::Vec3<float>, Common::Vec3<float>> GetStatus() const { | ||||
|         std::lock_guard<std::mutex> guard(status->update_mutex); | ||||
|         std::lock_guard guard(status->update_mutex); | ||||
|         return status->motion_status; | ||||
|     } | ||||
| 
 | ||||
|  | @ -41,7 +41,7 @@ public: | |||
| 
 | ||||
|     std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override { | ||||
|         { | ||||
|             std::lock_guard<std::mutex> guard(status->update_mutex); | ||||
|             std::lock_guard guard(status->update_mutex); | ||||
|             status->touch_calibration.emplace(); | ||||
|             // These default values work well for DS4 but probably not other touch inputs
 | ||||
|             status->touch_calibration->min_x = params.Get("min_x", 100); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue