Glenn Fowler writes:
> 
> On Thu, 14 Sep 2006 07:35:08 -0400 James Carlson wrote:
> > Joerg Schilling writes:
> > > Also, nftw() is not reentrant as it depends on static data that is 
> > > overwritten
> > > in case you run two instances from two threads at the same time.
> 
> > At least on Open Solaris[1], nftw() is safe in multithreaded
> > applications as long as you don't use FTW_CHDIR[2].  It doesn't use
> > static data, and instead passes around pointers to 'struct Var' and
> > 'struct Save' that are allocated on the stack.
> 
> > See ftw(3C) and $SRC/lib/libc/port/gen/nftw.c for details.
> 
> so the coding of diff -R would require 3 threads --
> one for nftw on directory A, one for nftw on directory B,
> and one to handle the nftw callbacks from the other two
> is that right?

Potentially, if that's how one were planning to code it.  I'm not sure
that ftw/nftw's design really lends itself well to that particular
usage.  (Nor why you'd _want_ to do that, except perhaps as an
excercise in obfuscation.)

-- 
James Carlson, KISS Network                    <james.d.carlson at sun.com>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

Reply via email to