summaryrefslogtreecommitdiff
path: root/src/input_common/keyboard.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2019-04-01 14:36:24 -0400
committerGravatar GitHub2019-04-01 14:36:24 -0400
commite0eee250bb4d70f4fc4973f08649636faf9808cf (patch)
treeeaf2aabd5471c13fe89ac5f7da247b3bf1248e83 /src/input_common/keyboard.cpp
parentMerge pull request #2304 from lioncash/memsize (diff)
parentgeneral: Use deducation guides for std::lock_guard and std::unique_lock (diff)
downloadyuzu-e0eee250bb4d70f4fc4973f08649636faf9808cf.tar.gz
yuzu-e0eee250bb4d70f4fc4973f08649636faf9808cf.tar.xz
yuzu-e0eee250bb4d70f4fc4973f08649636faf9808cf.zip
Merge pull request #2312 from lioncash/locks
general: Use deducation guides for std::lock_guard and std::unique_lock
Diffstat (limited to '')
-rw-r--r--src/input_common/keyboard.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_common/keyboard.cpp b/src/input_common/keyboard.cpp
index 525fe6abc..078374be5 100644
--- a/src/input_common/keyboard.cpp
+++ b/src/input_common/keyboard.cpp
@@ -36,18 +36,18 @@ struct KeyButtonPair {
36class KeyButtonList { 36class KeyButtonList {
37public: 37public:
38 void AddKeyButton(int key_code, KeyButton* key_button) { 38 void AddKeyButton(int key_code, KeyButton* key_button) {
39 std::lock_guard<std::mutex> guard(mutex); 39 std::lock_guard guard{mutex};
40 list.push_back(KeyButtonPair{key_code, key_button}); 40 list.push_back(KeyButtonPair{key_code, key_button});
41 } 41 }
42 42
43 void RemoveKeyButton(const KeyButton* key_button) { 43 void RemoveKeyButton(const KeyButton* key_button) {
44 std::lock_guard<std::mutex> guard(mutex); 44 std::lock_guard guard{mutex};
45 list.remove_if( 45 list.remove_if(
46 [key_button](const KeyButtonPair& pair) { return pair.key_button == key_button; }); 46 [key_button](const KeyButtonPair& pair) { return pair.key_button == key_button; });
47 } 47 }
48 48
49 void ChangeKeyStatus(int key_code, bool pressed) { 49 void ChangeKeyStatus(int key_code, bool pressed) {
50 std::lock_guard<std::mutex> guard(mutex); 50 std::lock_guard guard{mutex};
51 for (const KeyButtonPair& pair : list) { 51 for (const KeyButtonPair& pair : list) {
52 if (pair.key_code == key_code) 52 if (pair.key_code == key_code)
53 pair.key_button->status.store(pressed); 53 pair.key_button->status.store(pressed);
@@ -55,7 +55,7 @@ public:
55 } 55 }
56 56
57 void ChangeAllKeyStatus(bool pressed) { 57 void ChangeAllKeyStatus(bool pressed) {
58 std::lock_guard<std::mutex> guard(mutex); 58 std::lock_guard guard{mutex};
59 for (const KeyButtonPair& pair : list) { 59 for (const KeyButtonPair& pair : list) {
60 pair.key_button->status.store(pressed); 60 pair.key_button->status.store(pressed);
61 } 61 }