From 7da2a7bd584f1a55794b79c2b1c4473c04c6ddc2 Mon Sep 17 00:00:00 2001 From: un-lock-able Date: Thu, 24 Apr 2025 22:33:24 +0800 Subject: [PATCH] avoid read before write --- lab6/pipe_tester.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lab6/pipe_tester.cpp b/lab6/pipe_tester.cpp index 7ce67ea..33b40da 100644 --- a/lab6/pipe_tester.cpp +++ b/lab6/pipe_tester.cpp @@ -21,8 +21,8 @@ void reader() { int main() { std::thread writer_thread(writer); - std::thread reader_thread(reader); std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::thread reader_thread(reader); if (reader_thread.joinable()) { reader_thread.join(); }