Sync test: run with TSAN on Ubuntu

This commit is contained in:
SChernykh
2023-05-17 23:06:54 +02:00
parent 7134187dc9
commit 325f2dc22f
5 changed files with 26 additions and 3 deletions

View File

@@ -154,7 +154,9 @@ public:
memcpy(p + 1, buf + 1, size - 1);
// Ensure memory order in the writer thread
#ifndef DEV_WITH_TSAN
std::atomic_thread_fence(std::memory_order_seq_cst);
#endif
// Mark that everything is written into this log slot
p[0] = buf[0] + 1;
@@ -221,7 +223,9 @@ private:
}
// Ensure memory order in the reader thread
#ifndef DEV_WITH_TSAN
std::atomic_thread_fence(std::memory_order_seq_cst);
#endif
uint32_t size = static_cast<uint8_t>(p[2]);
size = (size << 8) + static_cast<uint8_t>(p[1]);