Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-12-17 17:57:32


At 04:42 PM 12/12/2004, Ben Hutchings wrote:
>I noticed that Boost.Filesystem doesn't use readdir_r to iterate over
>directories, even if it is available, making that non-thread-safe.
>There is a comment to this effect in operations_posix_windows.cpp.
>
>I've attached a patch that I believe will allow it to detect whether
>readdir_r is available and to use it iff it is. I have only tested this
>on Linux with g++ 3.3, but I tried deliberately breaking the declaration
>of readdir_r and verified that the code continues to work without it.

I started to look at this in detail this afternoon. Using overload
resolution to adjust to feature absence is an interesting technique, and
new to me. But is it really needed? POSIX specifies a feature test macro,
_POSIX_THREAD_SAFE_FUNCTIONS, which would seem to be sufficient. Was there
a reason you didn't use it? Is it not reliable on some systems?

Thanks,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk