On Saturday December 02 2017 17:36:03 David Faure wrote:

> "Why" is always hard, but your questions are only about "what", so that's 
> easy, the code answers that ;)

No, I think it was really about the why of the what, but thanks for confirming 
a few things.

> The goal of what? That categorized and off-by-default debug message?

No, why the code would be doing this:

> So this is reference counted. Nice, heh?

Sure, nifty. I thought it was doing something like that, but why would you want 
to reference-count this kind of feature? It seems that a simple off/on kind of 
reference counting (none, one-or-more if you prefer) should be enough here.
Or maybe I should ask: why is there no way to remove a watch on a file 
completely? I can think of a scenario where multiple things in an app would be 
watching a given file so you wouldn't want to release the watch until the last 
"thing" releases its watch, unless someone deletes the file.


> > As a result I feel I need to wrap each call to KDW::addDir(foo) with a check
> > of KDW::contains(foo).
> 
> No you don't need to do that.

Let me be a bit more specific. Of course I don't need to do this if all I want 
is to set a watch. But if watches are ref-counted that suggests at least that 
you have to remove an item as many times as you've added it to the watcher. 
(This is the bit where I didn't stare very hard at the code at all.)
So if I want to be able to remove watches without having to keep track of how 
many times I set one, I do need those wrappers. In my case watches are set by a 
single function which loads directories and can thus be called lots of times 
but they're basically unset only when directories are deleted (which usually 
happens only once ;)).

R.

Reply via email to