I’m trying to compile and run the following example on Ubuntu 10.10
http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/server3/
but it crashes at:
// Create a pool of threads to run all of the io_services.
std::vector<boost::shared_ptr<boost::thread> > threads;
for (std::size_t i = 0; i < thread_pool_size_; ++i)
{
boost::shared_ptr<boost::thread> thread(new boost::thread(
boost::bind(&boost::asio::io_service::run, &io_service_)));
threads.push_back(thread);
}
Call Stack:
Thread [1] 573 [core: 0] (Suspended : Signal : SIGSEGV:Segmentation fault)
boost::thread::start_thread() at 0x8064a64
boost::thread::thread<boost::_bi::bind_t<unsigned int, boost::_mfi::mf0<unsigned int, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >() at thread.hpp:204 0x805e8c6
http::server3::server::run() at server.cpp:57 0x8059cbf
main() at HttpServer3.cpp:38 0x8048522
However, it does NOT crash on Ubuntu 11.04, for the same Eclipse CDT project.
Any advice?
It seems ildjarn’s initial guess might be correct.
I found there are two versions of the boost lib on my Ubuntu 10.10. I removed them thoroughly, and installed the latest one, and the issue was gone.