diff options
author | meserve <mark.meserve@utexas.edu> | 2016-11-18 16:50:36 -0600 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-11-18 17:25:39 -0800 |
commit | ee4bb488684ddd913edfcb4cc09a50d94bf8a1f0 (patch) | |
tree | ad3ef5664a71b3f93150ac85586c04f7a7df9a62 /host | |
parent | f743c922d6412c3e3362f289bd6196f3754c5616 (diff) | |
download | uhd-ee4bb488684ddd913edfcb4cc09a50d94bf8a1f0.tar.gz uhd-ee4bb488684ddd913edfcb4cc09a50d94bf8a1f0.tar.bz2 uhd-ee4bb488684ddd913edfcb4cc09a50d94bf8a1f0.zip |
device: change hashing test logic from try-throw-catch to if-else
Allows to trigger on catches during debugging.
Reviewed-By: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/device.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp index ff4bbc212..c75ecad77 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -162,13 +162,11 @@ device::sptr device::make(const device_addr_t &hint, device_filter_t filter, siz static uhd::dict<size_t, boost::weak_ptr<device> > hash_to_device; //try to find an existing device - try{ - UHD_ASSERT_THROW(hash_to_device.has_key(dev_hash)); - UHD_ASSERT_THROW(not hash_to_device[dev_hash].expired()); + if (hash_to_device.has_key(dev_hash) and not hash_to_device[dev_hash].expired()){ return hash_to_device[dev_hash].lock(); } - //create and register a new device - catch(const uhd::assertion_error &){ + else { + //create and register a new device device::sptr dev = maker(dev_addr); hash_to_device[dev_hash] = dev; return dev; |