Boost logo

Boost :

From: James Sutherland (James.Sutherland_at_[hidden])
Date: 2008-01-25 13:40:19


I am getting segmentation violations from inside of boost::thread

Running valgrind, I get the following:
> ==31129== Thread 2:
> ==31129== Jump to the invalid address stated on the next line
> ==31129== at 0xEC834853E5894855: ???
> ==31129== by 0x4A4DDE1: boost::function0<void,
> std::allocator<boost::function_base> >::function0(boost::function0<void,
> std::allocator<boost::function_base> > const&) (function_template.hpp:527)
> ==31129== by 0x4A4CF21: thread_proxy (thread.cpp:106)
> ==31129== by 0x31A0D06136: start_thread (in /lib64/tls/libpthread-2.3.4.so)
> ==31129== by 0x31A04C7532: clone (in /lib64/tls/libc-2.3.4.so)
> ==31129== Address 0xEC834853E5894855 is not stack'd, malloc'd or (recently)
> free'd
> ==31129==
> ==31129== Process terminating with default action of signal 11 (SIGSEGV)
> ==31129== Bad permissions for mapped region at address 0xEC834853E5894855
> ==31129== at 0xEC834853E5894855: ???
> ==31129== by 0x4A4DDE1: boost::function0<void,
> std::allocator<boost::function_base> >::function0(boost::function0<void,
> std::allocator<boost::function_base> > const&) (function_template.hpp:527)
> ==31129== by 0x4A4CF21: thread_proxy (thread.cpp:106)
> ==31129== by 0x31A0D06136: start_thread (in /lib64/tls/libpthread-2.3.4.so)
> ==31129== by 0x31A04C7532: clone (in /lib64/tls/libc-2.3.4.so)

It seems that when the new thread is created. Totalview shows that the
thread dies in function_template.hpp at the line:
> f.vtable->manager(f.functor, this->functor,
> boost::detail::function::clone_functor_tag)

Any thoughts on what could be causing this? I am using boost_1_34_0. I
don¹t know if this is relevant, but I have a thread adaptor class that looks
like:
> class ThreadAdaptor
> {
> public:
> ThreadAdaptor( ExpressionBase& expr ) : expr_(expr) {}
> ThreadAdaptor(const ThreadAdaptor& ta) : expr_(ta.expr_) {}
> ~ThreadAdaptor(){}
> void operator()(){ expr_.evaluate(); }
> private:
> ThreadAdaptor& operator=(const ThreadAdaptor&); // no assignment
> ExpressionBase& expr_;
> };

Thanks for any advice,

James


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