Function close_fds::iter_open_fds_threadsafe [−][src]
pub fn iter_open_fds_threadsafe(minfd: c_int) -> FdIterⓘ
Equivalent to iter_open_fds(), but behaves more reliably in multithreaded programs (at the
cost of decreased performance on some platforms).
Specifically, if other threads open file descriptors at specific times, iter_open_fds()
may skip over other file descriptors. This function avoids those issues.
Note, however, that this behavior comes at the cost of significantly decreased performance on
certain platforms (currently, this is limited to 1) OpenBSD and 2) FreeBSD without an fdescfs
mounted on /dev/fd). This is because the non-thread-safe code provides a potential performance
improvement on those platforms.