Skip to content

Commit

Permalink
Merge pull request adafruit#757 from stinos/windows-fsync
Browse files Browse the repository at this point in the history
Add fsync for windows, i.e. _commit. See dce8876
  • Loading branch information
dpgeorge committed Jul 19, 2014
2 parents 2c07011 + 73ab8cc commit 04c9fec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions unix/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
#include "runtime.h"
#include "stream.h"

#ifdef _WIN32
#define fsync _commit
#endif

typedef struct _mp_obj_fdfile_t {
mp_obj_base_t base;
int fd;
Expand Down Expand Up @@ -83,12 +87,9 @@ STATIC mp_int_t fdfile_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int
}

STATIC mp_obj_t fdfile_flush(mp_obj_t self_in) {
#ifndef _WIN32
mp_obj_fdfile_t *self = self_in;
check_fd_is_open(self);
fsync(self->fd);
#else
//TODO
#endif
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_flush_obj, fdfile_flush);
Expand Down

0 comments on commit 04c9fec

Please sign in to comment.