[Gambas-user] Pb instanciating inotify watch

Tobias Boege taboege at gmail.com
Thu Mar 7 07:52:39 CET 2019


On Thu, 07 Mar 2019, T Lee Davidson wrote:
> On 3/7/19 1:16 AM, Tobias Boege wrote:
> > As far as I can see, you replaced
> > 
> >    hWatch.Events[Watch.Create] = True
> >    hWatch.Events[Watch.Delete] = True
> > 
> > by
> > 
> >    hWatch.Events[Watch.Delete Or Watch.Create] = True
> > 
> > Having to do this comes almost surely from a bug! It should be possible
> > to set events independently, because otherwise why would we have an
> > array accessor syntax for them instead of just a bitmask property?
> > 
> > The current implementation was done in the redesign phase mentioned
> > earlier in this thread and it doesn't use the RHS of the assignment
> > at all (try assigning False to .events[Watch.Create Or Watch.Delete],
> > it'll still work). That's a very strong sign it's an oversight bug.
> > I'm going to fix it, then fix the wiki example because why are you
> > watching "/" and observing changes?
> > 
> > Regards,
> > Tobi
> 
> Just FYI, Tobi, the documentation [0] mentions that the Events argument for
> the property signature ("hWatch.Events [ Events As Integer ] = aBoolean)
> should be a bitwise Or'd set:
> 
> "Turn monitoring on a non-empty set (bitwise OR'd) of Watch constants on or off."
> 
> [0] http://gambaswiki.org/wiki/comp/gb.inotify/.watch.events/_put
> 
> I don't know if that makes any difference to your conclusion.
> 

No, because I wrote that page and I also wrote the initial component,
there can't be a discrepancy here :-)

The excerpt you quote doesn't say you have to specify all the events
you want to watch as a bit-wise OR. It says you can use an OR of
multiple events to turn them on or off in a single call -- a single
event is also a bit-wise OR of events. You should still be able to
activate or deactivate them individually at any time.

Every use of `Watch.Events[Mask] = Value` sets all events in the
Mask (an OR of event constants representing a set of events) to Value,
without affecting the state of events outside the set. That's how
it was supposed to be, how it was initially implemented, how it is
documented inside the source code, how the array interface makes sense,
it's just not what the current implementation does.

(How are those Gambas test-suites coming along...?)

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list