summaryrefslogtreecommitdiff
path: root/src/input_common/motion_emu.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-01 12:29:59 -0400
committerLioncash <mathew1800@gmail.com>2019-04-01 12:53:47 -0400
commit781ab8407b50d303197ab6fb888ed35ecbcce23a (patch)
treeeaf2aabd5471c13fe89ac5f7da247b3bf1248e83 /src/input_common/motion_emu.cpp
parentd9b7bc44748908d49d59433870211df8e1c32581 (diff)
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.
Diffstat (limited to 'src/input_common/motion_emu.cpp')
-rw-r--r--src/input_common/motion_emu.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/input_common/motion_emu.cpp b/src/input_common/motion_emu.cpp
index 6d96d4019a..8682516285 100644
--- a/src/input_common/motion_emu.cpp
+++ b/src/input_common/motion_emu.cpp
@@ -39,7 +39,7 @@ public:
void Tilt(int x, int y) {
auto mouse_move = Common::MakeVec(x, y) - mouse_origin;
if (is_tilting) {
- std::lock_guard<std::mutex> guard(tilt_mutex);
+ std::lock_guard guard{tilt_mutex};
if (mouse_move.x == 0 && mouse_move.y == 0) {
tilt_angle = 0;
} else {
@@ -51,13 +51,13 @@ public:
}
void EndTilt() {
- std::lock_guard<std::mutex> guard(tilt_mutex);
+ std::lock_guard guard{tilt_mutex};
tilt_angle = 0;
is_tilting = false;
}
std::tuple<Common::Vec3<float>, Common::Vec3<float>> GetStatus() {
- std::lock_guard<std::mutex> guard(status_mutex);
+ std::lock_guard guard{status_mutex};
return status;
}
@@ -93,7 +93,7 @@ private:
old_q = q;
{
- std::lock_guard<std::mutex> guard(tilt_mutex);
+ std::lock_guard guard{tilt_mutex};
// Find the quaternion describing current 3DS tilting
q = Common::MakeQuaternion(
@@ -115,7 +115,7 @@ private:
// Update the sensor state
{
- std::lock_guard<std::mutex> guard(status_mutex);
+ std::lock_guard guard{status_mutex};
status = std::make_tuple(gravity, angular_rate);
}
}