Use blocking queue for RRC measurement fixes #193

This commit is contained in:
Ismael Gomez 2018-05-10 13:21:01 -05:00
parent 04609cd07d
commit 4515dd94ea
3 changed files with 8 additions and 4 deletions

View File

@ -86,6 +86,10 @@ public:
while (try_pop(item));
}
size_t size() {
return q.size();
}
private:
std::queue<myobj> q;
pthread_mutex_t mutex;

View File

@ -547,7 +547,7 @@ private:
void process_phy_meas();
void process_new_phy_meas(phy_meas_t meas);
std::queue<phy_meas_t> phy_meas_q;
srslte::block_queue<phy_meas_t> phy_meas_q;
// Cell selection/reselection functions/variables
typedef struct {

View File

@ -534,10 +534,10 @@ void rrc::new_phy_meas(float rsrp, float rsrq, uint32_t tti, int earfcn_i, int p
/* Processes all pending PHY measurements in queue. Must be called from a mutexed function
*/
void rrc::process_phy_meas() {
while(!phy_meas_q.empty()) {
phy_meas_t m;
while(phy_meas_q.try_pop(&m)) {
rrc_log->debug("MEAS: Processing measurement. %lu measurements in queue\n", phy_meas_q.size());
process_new_phy_meas(phy_meas_q.front());
phy_meas_q.pop();
process_new_phy_meas(m);
}
}