diff options
Diffstat (limited to 'host/lib/usrp/gps_ctrl.cpp')
-rw-r--r-- | host/lib/usrp/gps_ctrl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index 207ef10ab..32ed80dc3 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -28,6 +28,7 @@ #include <boost/tokenizer.hpp> #include <boost/format.hpp> #include <boost/regex.hpp> +#include <boost/thread/mutex.hpp> #include "boost/tuple/tuple.hpp" #include "boost/foreach.hpp" @@ -49,8 +50,10 @@ gps_ctrl::~gps_ctrl(void){ class gps_ctrl_impl : public gps_ctrl{ private: std::map<std::string, boost::tuple<std::string, boost::system_time, bool> > sensors; + boost::mutex cache_mutex; std::string get_cached_sensor(const std::string sensor, const int freshness, const bool once, const bool touch=true) { + boost::mutex::scoped_lock lock(cache_mutex); boost::system_time time = boost::get_system_time(); try { // this is nasty ... |