From 61c37b86401360ef5e687616bf60b163e03eb28f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 May 2026 23:14:57 +0000 Subject: [PATCH] Make TPTP temp file counter atomic Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/ca1df142-d992-4e45-a8b3-859fa70a5222 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- src/test/tptp.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/tptp.cpp b/src/test/tptp.cpp index 9c764ab64..889f31098 100644 --- a/src/test/tptp.cpp +++ b/src/test/tptp.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -49,10 +50,10 @@ class scoped_temp_file { std::string m_path; public: scoped_temp_file(char const* contents) { - static unsigned counter = 0; + static std::atomic counter(0); auto stamp = std::chrono::steady_clock::now().time_since_epoch().count(); m_path = (std::filesystem::temp_directory_path() / - ("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter++) + ".p")).string(); + ("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter.fetch_add(1)) + ".p")).string(); write_file(m_path.c_str(), contents); } ~scoped_temp_file() {