aboutsummaryrefslogtreecommitdiff
path: root/computer-network-experiment/Output.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-07 20:42:28 +0800
committercrupest <crupest@outlook.com>2021-06-07 20:42:28 +0800
commit3ac9362b11383574aca40b33bee55bee3970171c (patch)
treeda4e0cdf14801dfa4f549431aa365fa47a758899 /computer-network-experiment/Output.cpp
parent45ea1ec04953380ea50e346ba0f1b2eeda0c2dd3 (diff)
downloadlife-3ac9362b11383574aca40b33bee55bee3970171c.tar.gz
life-3ac9362b11383574aca40b33bee55bee3970171c.tar.bz2
life-3ac9362b11383574aca40b33bee55bee3970171c.zip
...
Diffstat (limited to 'computer-network-experiment/Output.cpp')
-rw-r--r--computer-network-experiment/Output.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/computer-network-experiment/Output.cpp b/computer-network-experiment/Output.cpp
index db97e5e..fbbd6ba 100644
--- a/computer-network-experiment/Output.cpp
+++ b/computer-network-experiment/Output.cpp
@@ -47,7 +47,7 @@ void PrintOutput(const Output &output) {
void OutputThread() {
while (true) {
- m.lock();
+ std::lock_guard<std::mutex> guard(m);
if (cancellation_source.getToken().isCancellationRequested()) {
while (true) {
@@ -63,8 +63,6 @@ void OutputThread() {
Output output;
if (output_queue.readIfNotEmpty(output))
PrintOutput(output);
-
- m.unlock();
}
}