X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ffile.cpp;h=ac514121dfa05fe99afa9aee4e51ba9fe66361c1;hp=9b1e433662c63e9fddfa8295fd7719789d471522;hb=d6b80800099c85df8d6f49b5b9d11e43f86c79b0;hpb=c0861d1f8e3869f058bc8b152cd35a08e5b03e73 diff --git a/source/file.cpp b/source/file.cpp index 9b1e433..ac51412 100644 --- a/source/file.cpp +++ b/source/file.cpp @@ -10,7 +10,7 @@ Distributed under the LGPL #include #endif #include -#include "error.h" +#include "except.h" #include "file.h" using namespace std; @@ -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.