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.

[1] We're still talking about Open Solaris, right?  ;-}

[2] The inherent problems with chdir should be obvious.

-- 
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