[Interest] QFileSystemWatcher malfunctioning

Atlant Schmidt aschmidt at dekaresearch.com
Thu Jan 12 14:56:26 CET 2012


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.

  A later reply talks about hashing the file; if you
  really want precision notification of modifications,
  then that's the sort of thing you have to do *EVERY
  TIME* the file watcher tells you a modification has
  been made, even if you suspect that the modification
  was your own. Either that, or lock-out other changers
  while you make your change.

                                   Atlant

-----Original Message-----
From: interest-bounces+aschmidt=dekaresearch.com at qt-project.org [mailto:interest-bounces+aschmidt=dekaresearch.com at qt-project.org] On Behalf Of André Somers
Sent: Thursday, January 12, 2012 03:27
To: interest at qt-project.org
Subject: Re: [Interest] QFileSystemWatcher malfunctioning

Op 12-1-2012 9:14, Bo Thorsen schreef:
> I just put my SignalBlocker implementation on my blog:
>
> http://www.fioniasoftware.dk/blog/?p=158
>
> (Sorry for the plug but it was a bit long for a mail, and there might be
> other interested in it.)
>
> With this class you just do this:
>
> {
>     SignalBlocker blocker(watcher);
>     modifyTheFile();
> }
>
> I hope this helps.
>
Funny, I wrote exactly the same class (ok, named slightly differently)
at work just a month ago or so :-)

André

_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


 Click https://www.mailcontrol.com/sr/!2Y+ytpCNNXTndxI!oX7UsdpzMR7Bo2KuJJ25aNl2Ia2ErDASQGKpjk4Jw0OJtPBO9sXebjFfhJ6aunJTqVygQ==  to report this email as spam.

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.



More information about the Interest mailing list