ast fts provides void* fts_handle in the FTS handle returned by fts_open()
fts_handle is initialized to 0; the caller can set it to any value
and that value is preserved until fts_close()

also provided is FTS* fts in the FTSENT struct
the caller defined comparison function takes two FTSENT** pointers
each makes the FTS* fts available and from that you can get fts_handle

-- Glenn Fowler -- AT&T Research, Florham Park NJ --

On Tue, 06 May 2008 23:22:37 -0400 Will Young wrote:
>     One of the reasons I would prefer to use fts_* directly rather than 
> ftwalk() is the thread safety.
> With fts_open(), fts_read() my function can know its own context, with 
> ftwalk() or nftw() a commonly available user function must resort to 
> globals.  (The static fts_compare state in ftwalk() also looks like a MT 
> problem.)

>     With the fts_* design, the one MT issue I see is in the comparator, 
> (it does not matter in my context since there are no thread/context 
> specific behaviors to my comparator,) but for general cases the 
> comparator should probably have been given access to a void * registered 
> on fts_open().


Reply via email to