Boost logo

Boost :

From: Geurt Vos (G.Vos_at_[hidden])
Date: 2003-08-22 08:02:18


>
> > boost-1.30.2, SuSE Linux 8.2, GCC-3.3:
> >
> > an #include <boost/thread.hpp> results in
> > #error Thread support not available!
> >
> > It seems that since 1.30.2 on Linux it is
> > disabled by default, correct? why?
> >
> > gcc.hpp reads:
> >
> > #if [...] !defined(linux) && !define(__linux) && !define(__linux__)
> > # define BOOST_HAS_THREADS
> > #endif
> >
> > so...how do I enable threads for Linux?
>
> Compile with the -pthreads flag, actually you always had to
> do that if you
> wanted code that would actually work and be free of race
> conditions, rather
> than just "compile". It's just that now we check you're
> doing the right
> thing :-)
>

Ok, I get that. Anything else I need to know?
I mean, is boost bjammed correctly for thread
support? The thing is that the following code
segfaults on '-pthread'

#include <boost/filesystem/operations.hpp>

int main()
{
    *boost::filesystem::directory_iterator("/");
}

------------

# g++ -o test test.cpp -lboost_filesystem
# ./test
--- no problem

# g++ -pthread -o test test.cpp -lboost_filesystem
#./test
--- segmentation fault

Also, in the GCC manual '-pthread' is only mentioned
in the 'RS/6000 and PowerPC Options' section...which
is kind of confusing, since it 's not a '-m' option
and doesn't look architecture specific

Geurt


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