KDirWatch emitting dirty signal many times for one change

Josef Weidendorfer Josef.Weidendorfer at gmx.de
Wed Mar 24 15:18:58 GMT 2004

On Tuesday 23 March 2004 14:11, Matthias Kretz wrote:
> Hash: SHA1
> On Tuesday 23 March 2004 12:59, David Faure wrote:
> > > Couldn't KDirWatch compress the notifications into one signal?
> >
> > I thought it already did?
> Look at the test program I attached to my first email. I get 271
> notifications with it.

You are using FAM and your FAM is using DNOTIFY.
This is more or less the only case where no delaying currently is done ;-(

Regarding your other problem:
If you remove the file from KDirWatch while saving, and adding it later on, 
there should be no change modifications. As you said, this seems not to work 
always reliable currently.

I'm not sure how to do this: Even if the save() operation is synchronous, 
there could be some latency till the changes are written by a remote NFS 
server, and a FAM daemon on this NFS server would signal changes with some 
delay to the FAM of your machine and to your application.

If there is a general way to improve it, I'm open for ideas.
A solution I could imagine: Remove most of FAM handling, and do the following 
when a FAM event occurs: start a timer for our own file change check, i.e. do 
the same as when a DNOTIFY signal occurs. Note that the checking is always 
based on doing stat() on our own. And if you add a file after saving, the 
stat() which is done at adding should yield the same as a stat() done 
sometimes later when a FAM event arrives for this file, i.e. no further 
change signal.

Remark: We should use m_PollInterval for the timeout value in 
KDirWatchPrivate::slotActivated, not a fixed 200ms.


> - --
> C'ya
>         Matthias
> ________________________________________________________
> Matthias Kretz (Germany)                          <><
> http://Vir.homeip.net/
> MatthiasKretz at gmx.net, kretz at kde.org,
> Matthias.Kretz at urz.uni-heidelberg.de
> Version: GnuPG v1.2.4 (GNU/Linux)
> iD8DBQFAYDejyg4WnCj6OIoRAjLDAKDqj3VsY3kB5SaMGZ6jK4cIeRN48gCeM4Yv
> NiICw7sRPijUk5W4yG2G2EY=
> =6YoU

More information about the kde-core-devel mailing list