forked from GitHub/gf-core
make sure that changes in the database are always flushed
This commit is contained in:
@@ -309,6 +309,16 @@ DB::~DB() {
|
||||
close(fd);
|
||||
}
|
||||
|
||||
void DB::sync()
|
||||
{
|
||||
size_t size =
|
||||
current_db->ms->top + size + sizeof(size_t);
|
||||
|
||||
int res = msync((void *) current_db->ms, size, MS_SYNC | MS_INVALIDATE);
|
||||
if (res != 0)
|
||||
throw std::system_error(errno, std::generic_category());
|
||||
}
|
||||
|
||||
moffset DB::get_root_internal() {
|
||||
return ms->root_offset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user