X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ffile.cpp;h=ac514121dfa05fe99afa9aee4e51ba9fe66361c1;hp=a22b832be46a4f56179544fa96cc2cc0d8de331b;hb=d6b80800099c85df8d6f49b5b9d11e43f86c79b0;hpb=c8a3f4ae89bc415bfbd877b3f4c3605ac3cf4010 diff --git a/source/file.cpp b/source/file.cpp index a22b832..ac51412 100644 --- a/source/file.cpp +++ b/source/file.cpp @@ -105,7 +105,7 @@ void File::close() set_events(P_NONE); - signal_closing.emit(); + signal_flush_required.emit(); #ifdef WIN32 CloseHandle(handle); @@ -134,6 +134,15 @@ void File::set_block(bool b) #endif } +void File::sync() +{ +#ifndef WIN32 + signal_flush_required.emit(); + + fsync(handle); +#endif +} + /** Seeks the file to the given byte offset. @@ -146,6 +155,8 @@ int File::seek(int off, SeekType st) { check_access(M_NONE); + signal_flush_required.emit(); + int type=sys_seek_type(st); #ifdef WIN32 DWORD ret=SetFilePointer(handle, off, 0, type); @@ -232,13 +243,6 @@ unsigned File::do_write(const char *buf, unsigned size) return ret; } -void File::sync() -{ -#ifndef WIN32 - fsync(handle); -#endif -} - /** Reads data from the file.