Skip to content

Commit

Permalink
Use F_BARRIERFSYNC on Apple operating systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadoc committed Oct 29, 2024
1 parent a91a0cb commit 14e353c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/unix/file_access_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,15 @@ void FileAccessUnix::_sync() {
int fd = fileno(f);
ERR_FAIL_COND(fd < 0);

#ifdef __APPLE__
return fcntl(fd, F_BARRIERFSYNC);
#else
int fsync_error;
do {
fsync_error = fsync(fd);
} while (fsync_error < 0 && errno == EINTR);
ERR_FAIL_COND_MSG(fsync_error < 0, strerror(errno));
#endif
}

void FileAccessUnix::_close() {
Expand Down

0 comments on commit 14e353c

Please sign in to comment.