MD5 summing & comparing would be the only way, and even then another program
would be indistinguishable if it made the same changes. However that corner
case should be a moot point.
________________________________
From: Bo Thorsen <b...@fioniasoftware.dk>
To: interest@qt-project.org
Sent: Thursday, January 12, 2012 4:13 PM
Subject: Re: [Interest] QFileSystemWatcher malfunctioning
Den 12-01-2012 14:56, Atlant Schmidt skrev:
> All:
>
>> With this class you just do this:
>>
>> {
>> SignalBlocker blocker(watcher);
>> modifyTheFile();
>> }
>
> It seems to me that there's a race condition here.
> Unless you're taking steps to deliberately lock-out
> other processes from modifying the file, then they
> could slip in immediately before or after you modify
> the file and you would never know they'd been there
> because you have the signal blocked.
True. But if you modify the file, you have a race condition anyway,
since you don't know if that was done before or after you do this. You
might not get the modified signal before you change the file contents.
If you're after a fool proof system, don't block the filewatcher and
read it after your own changes, and check that the contents hadn't been
changed before you do it. Or use a database.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest