> 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 mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hmm. Does it still hang if you don't link to libboost_filesystem, but
manually add the sources from libs/filesystem/src to your program?
Hmm. Does it still hang if you don't link to libboost_filesystem, but manually add the sources from libs/filesystem/src to your program?
Most likely, although I have no idea what's causing it.
Maybe something related with threading... I saw somewhere
BOOST_SP_DISABLE_THREADS
Do you think it might help? If yes, is that something to bet set both
for boost build AND project build
Frank
It is possible that BOOST_HAS_THREADS is being set for the library build and
not for the project build, or vice versa. The thread autodetection logic is
pretty complicated for gcc; maybe the fact that you're cross-compiling is
confusing it.
> I saw somewhere BOOST_SP_DISABLE_THREADS
>
> Do you think it might help? If yes, is that something to bet set both
> for boost build AND project build
Yes, it should be set for both. This should take care of the
shared_ptr-related issues.
In principle, it might be better if you can solve the BOOST_HAS_THREADS
mismatch since it has the potential to cause you more trouble in other
libraries. If you don't need threads, you may try rebuilding (both Boost and
the project) with BOOST_DISABLE_THREADS defined.