Boost logo

Boost Users :

Subject: Re: [Boost-users] directory_iterator ++operator never return
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-05-19 08:08:50


"gtsml owevwr" (Frank):

> Hi,
>
> I'm getting a list of the file in a directory like that:
>
> fs::directory_iterator end ;
> for( fs::directory_iterator iter(myfilepath) ; iter != end ; ++iter )
> {...}
>
> And at some point in this for loop, the ++operator never return, see
> callstack (single-thread build).

...

> #0 0x31d41270 in swtch_pri
> #1 0x31dd19cc in sched_yield
> #2 0x000ac1d4 in boost::detail::yield at yield_k.hpp:110
> #3 0x000adb54 in scoped_lock [inlined] at detail:45
> #4 0x000adb54 in boost::detail::spinlock::lock at detail:32
> #5 0x000adb54 in atomic_exchange_and_add [inlined] at detail:61
> #6 0x000adb54 in boost::detail::sp_counted_base::release at detail:100

Things to try:

- does it still hang if you remove the ... from the loop and just use the
directory iterator to walk through the directory without doing anything?

- does a simple use of shared_ptr hang?

int main()
{
    shared_ptr<int> p( new int );
    p.reset(); // here
}

- #define BOOST_SP_USE_PTHREADS;
- #define BOOST_SP_DISABLE_THREADS.


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