avoid read before write
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user