mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-03 00:45:41 +02:00
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
23 lines
516 B
C++
23 lines
516 B
C++
#ifndef MEMFILE_HPP
|
|
#define MEMFILE_HPP
|
|
|
|
#include <atomic>
|
|
#include <string>
|
|
#include "errors.hpp"
|
|
|
|
struct memfile {
|
|
int fd = 0;
|
|
std::string map;
|
|
unsigned long tree = 0;
|
|
FILE *fp = NULL;
|
|
// Read by checkdisk() from other threads while the owning reader thread appends
|
|
std::atomic<size_t> off{0};
|
|
};
|
|
|
|
struct memfile *memfile_open(int fd);
|
|
int memfile_close(struct memfile *file);
|
|
int memfile_write(struct memfile *file, void *s, long long len, bool &in_memory);
|
|
void memfile_full(struct memfile *file);
|
|
|
|
#endif
|