From 42f7fc1876cbe68569771b97a8935fbca7fa3ee4 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 7 Jun 2021 20:42:28 +0800 Subject: import(life): ... --- works/life/computer-network-experiment/Output.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'works/life/computer-network-experiment/Output.cpp') diff --git a/works/life/computer-network-experiment/Output.cpp b/works/life/computer-network-experiment/Output.cpp index db97e5e..fbbd6ba 100644 --- a/works/life/computer-network-experiment/Output.cpp +++ b/works/life/computer-network-experiment/Output.cpp @@ -47,7 +47,7 @@ void PrintOutput(const Output &output) { void OutputThread() { while (true) { - m.lock(); + std::lock_guard 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(); } } -- cgit v1.2.3