3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-25 11:26:21 +00:00

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>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-23 23:14:57 +00:00 committed by GitHub
parent 1947446736
commit 61c37b8640
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,4 @@
#include <atomic>
#include <cstdio>
#include <chrono>
#include <filesystem>
@ -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<unsigned> 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() {