Boost logo

Boost Users :

From: Russ Wood (rw99_at_[hidden])
Date: 2003-03-20 17:32:45


Hi,

When using the filesystem lib in the 1.30.0 release, I experience hangs
when incrementing the directory iterator.

The compiler I've been using is MinGW, an example that exhibits the
behaviour on my machine is included below.

The hang only occurs when -mthreads is used.

The hang occurs on the increment when there are no more files in the
directory.

Russ

// -------------------------------------------------------- cut
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <iostream>

namespace fs = boost::filesystem;

int main ( void )
{
        fs::path cwd ( fs::initial_path() );

        fs::directory_iterator entry ( cwd );
        fs::directory_iterator end;

        while ( entry != end )
        {
                fs::path const dirent ( *entry );
                std::cout << dirent.native_file_string() << std::endl;

                ++ entry;

                std::cout << "next iteration" << std::endl;
        }
}

----
Russell Wood - Dept. of Computing, Imperial College, London.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net