mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Make memfile offset atomic so checkdisk() can read it from other threads
checkdisk() is called from the parsing threads and sums the write positions of every reader. The geometry/index/vertex/node positions were already std::atomic, but memfile::off (the string pool and tree sizes) was a plain size_t that the owning thread updates in memfile_write(), which ThreadSanitizer reports as a data race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EfWkLhwEvKQoNGVPsLGehj
This commit is contained in:
+2
-1
@@ -10,7 +10,8 @@ struct memfile {
|
|||||||
std::string map;
|
std::string map;
|
||||||
unsigned long tree = 0;
|
unsigned long tree = 0;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
size_t off = 0;
|
// Read by checkdisk() from other threads while the owning reader thread appends
|
||||||
|
std::atomic<size_t> off{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct memfile *memfile_open(int fd);
|
struct memfile *memfile_open(int fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user