Hi all, the usrp2 destructor can throw an exeption due the fact that while destroying the implementation ( usrp2::impl::~impl() ) a stop_bg() is performed.
The stop_bg implementation is: void usrp2::impl::stop_bg() { d_bg_running = false; d_bg_pending_cond.notify_one(); // FIXME: check if needed d_rx_tg.join_all(); } indeed the boost::thread_group::join_all is an interruption point for boost thread. This can lead to a crash in case an user thread (using boost threads) receives an interruption while a stack unwinding is already occurring and an usrp2 is destroyed. There are two ways to correct the problem: 1) Instanziate a boost::this_thread::disable_interruption inside the stop_bg() 2) or do a try{ } catch() { } inside the impl destructor. This is very dangerous because normaly the user code acquire a usrp instance with a boost::shared_ptr, I guess this was done to reliefe the user to perform an explicit delete, however due this bug the user is forced to do: usrp2::usrp2::sptr myDevice = usrp2::usrp2::make("eth1", "", 1024*1024) ... try { myDevice.reset(); } catch(...) { } Regards Gaetano Mendola -- cpp-today.blogspot.com _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio