diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 0cad7ec65..da186273f 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include // for std::reverse #include // std::chrono::seconds #include // for std::fmod diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 5f0c7a8cb..792eafb9a 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -34,12 +34,12 @@ #include "concurrent_queue.h" +#include "galileo_ephemeris.h" +#include "glonass_gnav_ephemeris.h" +#include "glonass_gnav_utc_model.h" #include "gnss_synchro.h" -#include -#include -#include -#include -#include +#include "gps_cnav_ephemeris.h" +#include "gps_ephemeris.h" #include #include #include @@ -48,6 +48,7 @@ #include #include // for memcpy #include +#include #include #include #include diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index d30959017..9c94a78d4 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -39,6 +39,7 @@ #include "gps_cnav_ephemeris.h" #include "gps_ephemeris.h" #include "rtcm.h" +#include #include #include // for tm #include // for exception diff --git a/src/core/receiver/concurrent_queue.h b/src/core/receiver/concurrent_queue.h index 66cefbf96..7769a1406 100644 --- a/src/core/receiver/concurrent_queue.h +++ b/src/core/receiver/concurrent_queue.h @@ -31,8 +31,11 @@ #ifndef GNSS_SDR_CONCURRENT_QUEUE_H #define GNSS_SDR_CONCURRENT_QUEUE_H -#include +#include +#include +#include #include +#include template @@ -48,7 +51,7 @@ class Concurrent_Queue public: void push(Data const& data) { - boost::mutex::scoped_lock lock(the_mutex); + std::unique_lock lock(the_mutex); the_queue.push(data); lock.unlock(); the_condition_variable.notify_one(); @@ -56,13 +59,13 @@ public: bool empty() const { - boost::mutex::scoped_lock lock(the_mutex); + std::unique_lock lock(the_mutex); return the_queue.empty(); } bool try_pop(Data& popped_value) { - boost::mutex::scoped_lock lock(the_mutex); + std::unique_lock lock(the_mutex); if (the_queue.empty()) { return false; @@ -74,7 +77,7 @@ public: void wait_and_pop(Data& popped_value) { - boost::mutex::scoped_lock lock(the_mutex); + std::unique_lock lock(the_mutex); while (the_queue.empty()) { the_condition_variable.wait(lock); @@ -82,10 +85,26 @@ public: popped_value = the_queue.front(); the_queue.pop(); } - + + bool timed_wait_and_pop(Data& popped_value, int wait_ms) + { + std::unique_lock lock(the_mutex); + if (the_queue.empty()) + { + the_condition_variable.wait_for(lock, std::chrono::milliseconds(wait_ms)); + if (the_queue.empty()) + { + return false; + } + } + popped_value = the_queue.front(); + the_queue.pop(); + return true; + } + private: std::queue the_queue; - mutable boost::mutex the_mutex; - boost::condition_variable the_condition_variable; + mutable std::mutex the_mutex; + std::condition_variable the_condition_variable; }; #endif