summaryrefslogtreecommitdiffstats
path: root/host/lib/device.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-30 17:11:46 -0700
committerJosh Blum <josh@joshknows.com>2011-04-30 17:11:46 -0700
commit493ed897f24fff5265b766ee634916b002cadf94 (patch)
tree09082fa8be0c71b92ca668083dd1519a452b679d /host/lib/device.cpp
parent7b509d6fe4ac4cfcafc63f11f5b298d3e0237acd (diff)
parent1e57d1c0496ca6263652cd84c9eeacafde833915 (diff)
downloaduhd-493ed897f24fff5265b766ee634916b002cadf94.tar.gz
uhd-493ed897f24fff5265b766ee634916b002cadf94.tar.bz2
uhd-493ed897f24fff5265b766ee634916b002cadf94.zip
Merge branch 'master' into next
Conflicts: host/lib/usrp/usrp2/usrp2_regs.cpp
Diffstat (limited to 'host/lib/device.cpp')
-rw-r--r--host/lib/device.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp
index 1b3daa103..b2b0238d2 100644
--- a/host/lib/device.cpp
+++ b/host/lib/device.cpp
@@ -25,10 +25,13 @@
#include <boost/weak_ptr.hpp>
#include <boost/functional/hash.hpp>
#include <boost/tuple/tuple.hpp>
+#include <boost/thread/mutex.hpp>
#include <iostream>
using namespace uhd;
+static boost::mutex _device_mutex;
+
/***********************************************************************
* Helper Functions
**********************************************************************/
@@ -70,6 +73,8 @@ void device::register_device(
* Discover
**********************************************************************/
device_addrs_t device::find(const device_addr_t &hint){
+ boost::mutex::scoped_lock lock(_device_mutex);
+
device_addrs_t device_addrs;
BOOST_FOREACH(const dev_fcn_reg_t &fcn, get_dev_fcn_regs()){
@@ -93,6 +98,8 @@ device_addrs_t device::find(const device_addr_t &hint){
* Make
**********************************************************************/
device::sptr device::make(const device_addr_t &hint, size_t which){
+ boost::mutex::scoped_lock lock(_device_mutex);
+
typedef boost::tuple<device_addr_t, make_t> dev_addr_make_t;
std::vector<dev_addr_make_t> dev_addr_makers;