Re: FAM based fswatcher - first try

2007-01-24 Thread Philippe Roussel
On Wed, Jan 24, 2007 at 09:27:05PM +0200, Enrico Sersale wrote:
> The original fswatcher doesn't create a new Watcher object if there already 
> is one for a path beeing added; it adds only a "listener", that is, it 
> increments a counter. When, removing all listeners, the counter becomes 0, 
> the Watcher object is removed from the watchers array.

In this case, a Watcher keeps a NSCountedSet of clients/listeners. If
you call fswatcher 10 times with the same path, a single watcher (with
a single FAM request) will be created, modulo bugs of course.

> '--daemon' is not intended to be used from the command line; it is only an 
> internal way to create a daemon using only NSTask instead of fork(); many 
> GNUstep daemons does this; gdnc, gpbs, etc.

Ok, thanks for the explanation.

Philippe
-- 
Always think of something new; this helps you forget your last rotten idea. 
Seth Frankel



___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FAM based fswatcher - first try

2007-01-24 Thread Enrico Sersale

On 2007-01-24 19:05:01 +0200 Philippe Roussel <[EMAIL PROTECTED]> wrote:


Hi all

You will find attached a implementation of fswatcher using the FAM
API. It should link either with FAM (1) or gamin (2), which are
available on different flavors of unix. The goal is to take advantage
of existing facilities and getting rid of timers. FAM and gamin use
kernel helpers to avoid polling when they can.

The code probably has some bugs and I'm not sure I followed exactly
the different notifications semantics but it's a start. I tested it
with GWorkspace and it seems to work well.

Opinions ?


The original fswatcher doesn't create a new Watcher object if there already is one for a 
path beeing added; it adds only a "listener", that is, it increments a counter. 
When, removing all listeners, the counter becomes 0, the Watcher object is removed from 
the watchers array.


Philippe

NB : fswatcher parameter '--daemon' results in the opposite, or I am
missing something ?


'--daemon' is not intended to be used from the command line; it is only an 
internal way to create a daemon using only NSTask instead of fork(); many 
GNUstep daemons does this; gdnc, gpbs, etc.


1 - http://oss.sgi.com/projects/fam/
2 - http://www.gnome.org/~veillard/gamin/





___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


FAM based fswatcher - first try

2007-01-24 Thread Philippe Roussel
Hi all

You will find attached a implementation of fswatcher using the FAM
API. It should link either with FAM (1) or gamin (2), which are
available on different flavors of unix. The goal is to take advantage
of existing facilities and getting rid of timers. FAM and gamin use
kernel helpers to avoid polling when they can.

The code probably has some bugs and I'm not sure I followed exactly
the different notifications semantics but it's a start. I tested it
with GWorkspace and it seems to work well.

Opinions ?

Philippe

NB : fswatcher parameter '--daemon' results in the opposite, or I am
missing something ?

1 - http://oss.sgi.com/projects/fam/
2 - http://www.gnome.org/~veillard/gamin/
-- 
The power of accurate observation is frequently called cynicism by those who 
don't have it. George Bernard Shaw



fswatcher-fam-0.5.tar.gz
Description: Binary data
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev