[Qt-interest] QFile and fsynch(): how does it handle it?

Marco Borm qt-lists at retrodesignfan.eu
Wed Nov 25 00:51:56 CET 2009


The point is that if you want to write into file: just do it.
Syncing every file operation wastes performances without any benefit in 
_nearly_ any situation.
What do you think happens if you system crashes while fsync() is 
running? You can not prevent losing data which isn't written to disk and 
because your PC has a RAM this is always the case.
The only situation where you have to sync is before starting a operation 
which depends on the successful completion of a previous one. In that 
case you have to sync to take sure that the other operation is "on 
disk". Because Qt doesn't know what you indention is, it can't sync for you.
Unfortunately, and that is bad, there is also no Qt sync function you 
can call yourself.


Marco

Rui Maciel wrote:
> Thiago Macieira wrote:
>
>   
>> No need. Syncing is not necessary.
>>     
>
> So does QFile guarantee that, unless a call to QFile::write() fails, all data that was sent to the file is 
> always successfully transfered to the storage device?
>
>
> Rui Maciel
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   




More information about the Qt-interest-old mailing list