Make file positions and lengths thread-safe

This commit is contained in:
Eric Fischer
2018-05-07 14:42:49 -07:00
parent 2cf0524037
commit 59dd095607
10 changed files with 110 additions and 60 deletions
+7 -1
View File
@@ -1,12 +1,18 @@
#ifndef MEMFILE_HPP
#define MEMFILE_HPP
#include <atomic>
struct memfile {
int fd = 0;
char *map = NULL;
long long len = 0;
std::atomic<long long> len;
long long off = 0;
unsigned long tree = 0;
memfile()
: len(0) {
}
};
struct memfile *memfile_open(int fd);