diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-01 17:46:59 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-01 17:46:59 -0700 |
commit | 9f8a2d036970b6756de68d374f2ba203cddb0028 (patch) | |
tree | 1b4a70eb234d4958d9f7414bd6304676ba298dc1 /host/lib | |
parent | 70abc2e231e542929fb4d24fca7a2ad419930415 (diff) | |
download | uhd-9f8a2d036970b6756de68d374f2ba203cddb0028.tar.gz uhd-9f8a2d036970b6756de68d374f2ba203cddb0028.tar.bz2 uhd-9f8a2d036970b6756de68d374f2ba203cddb0028.zip |
usrp2: catch exceptions thrown in locker loop (like the user unplugs device)
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index bf7fe803f..85858929d 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -19,6 +19,7 @@ #include "fw_common.h" #include "usrp2_iface.hpp" #include <uhd/exception.hpp> +#include <uhd/utils/msg.hpp> #include <uhd/types/dict.hpp> #include <boost/thread.hpp> #include <boost/foreach.hpp> @@ -143,10 +144,17 @@ public: //sleep for a bit boost::this_thread::sleep(boost::posix_time::milliseconds(1500)); } - } catch(const boost::thread_interrupted &){} - - //unlock on exit - this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0); + } + catch(const boost::thread_interrupted &){ + this->get_reg<boost::uint32_t, USRP2_REG_ACTION_FW_POKE32>(U2_FW_REG_LOCK_TIME, 0); //unlock on exit + } + catch(const std::exception &e){ + UHD_MSG(error) + << "An unexpected exception was caught in the locker loop." << std::endl + << "The device will automatically unlock from this process." << std::endl + << e.what() << std::endl + ; + } } /*********************************************************************** |