summaryrefslogtreecommitdiff
path: root/src/video_core/gpu_thread.h
diff options
context:
space:
mode:
authorGravatar Lioncash2019-04-01 12:29:59 -0400
committerGravatar Lioncash2019-04-01 12:53:47 -0400
commit781ab8407b50d303197ab6fb888ed35ecbcce23a (patch)
treeeaf2aabd5471c13fe89ac5f7da247b3bf1248e83 /src/video_core/gpu_thread.h
parentMerge pull request #2304 from lioncash/memsize (diff)
downloadyuzu-781ab8407b50d303197ab6fb888ed35ecbcce23a.tar.gz
yuzu-781ab8407b50d303197ab6fb888ed35ecbcce23a.tar.xz
yuzu-781ab8407b50d303197ab6fb888ed35ecbcce23a.zip
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/video_core/gpu_thread.h')
-rw-r--r--src/video_core/gpu_thread.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h
index 6ab7142f8..70acb2e79 100644
--- a/src/video_core/gpu_thread.h
+++ b/src/video_core/gpu_thread.h
@@ -95,13 +95,13 @@ struct SynchState final {
95 std::condition_variable frames_condition; 95 std::condition_variable frames_condition;
96 96
97 void IncrementFramesCounter() { 97 void IncrementFramesCounter() {
98 std::lock_guard<std::mutex> lock{frames_mutex}; 98 std::lock_guard lock{frames_mutex};
99 ++queued_frame_count; 99 ++queued_frame_count;
100 } 100 }
101 101
102 void DecrementFramesCounter() { 102 void DecrementFramesCounter() {
103 { 103 {
104 std::lock_guard<std::mutex> lock{frames_mutex}; 104 std::lock_guard lock{frames_mutex};
105 --queued_frame_count; 105 --queued_frame_count;
106 106
107 if (queued_frame_count) { 107 if (queued_frame_count) {
@@ -113,7 +113,7 @@ struct SynchState final {
113 113
114 void WaitForFrames() { 114 void WaitForFrames() {
115 { 115 {
116 std::lock_guard<std::mutex> lock{frames_mutex}; 116 std::lock_guard lock{frames_mutex};
117 if (!queued_frame_count) { 117 if (!queued_frame_count) {
118 return; 118 return;
119 } 119 }
@@ -121,14 +121,14 @@ struct SynchState final {
121 121
122 // Wait for the GPU to be idle (all commands to be executed) 122 // Wait for the GPU to be idle (all commands to be executed)
123 { 123 {
124 std::unique_lock<std::mutex> lock{frames_mutex}; 124 std::unique_lock lock{frames_mutex};
125 frames_condition.wait(lock, [this] { return !queued_frame_count; }); 125 frames_condition.wait(lock, [this] { return !queued_frame_count; });
126 } 126 }
127 } 127 }
128 128
129 void SignalCommands() { 129 void SignalCommands() {
130 { 130 {
131 std::unique_lock<std::mutex> lock{commands_mutex}; 131 std::unique_lock lock{commands_mutex};
132 if (queue.Empty()) { 132 if (queue.Empty()) {
133 return; 133 return;
134 } 134 }
@@ -138,7 +138,7 @@ struct SynchState final {
138 } 138 }
139 139
140 void WaitForCommands() { 140 void WaitForCommands() {
141 std::unique_lock<std::mutex> lock{commands_mutex}; 141 std::unique_lock lock{commands_mutex};
142 commands_condition.wait(lock, [this] { return !queue.Empty(); }); 142 commands_condition.wait(lock, [this] { return !queue.Empty(); });
143 } 143 }
144 144