我正在尝试在Ubuntu 10.10上编译并运行以下示例
http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/server3/
但它崩溃了:
// 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);
}
调用堆栈:
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
但是,对于相同的Eclipse CDT项目,它不会在Ubuntu 11.04上崩溃。
有什么建议吗?
答案 0 :(得分:0)
似乎ildjarn的初步猜测可能是正确的。
我发现在我的Ubuntu 10.10上有两个版本的boost lib。我彻底删除了它们,并安装了最新版本,问题就消失了。