SRSUE: proc_ra.h/.cc use C++11 mutex

This commit is contained in:
Xavier Arteaga 2019-06-11 00:57:10 +02:00 committed by Xavier Arteaga
parent 5d87aece0f
commit cd036d8760
2 changed files with 5 additions and 8 deletions

View File

@ -22,6 +22,7 @@
#ifndef SRSUE_PROC_RA_H
#define SRSUE_PROC_RA_H
#include <mutex>
#include <stdint.h>
#include "srslte/common/log.h"
@ -182,7 +183,7 @@ private:
uint64_t transmitted_contention_id;
uint16_t transmitted_crnti;
pthread_mutex_t mutex;
std::mutex mutex;
enum { PDCCH_CRNTI_NOT_RECEIVED = 0, PDCCH_CRNTI_UL_GRANT, PDCCH_CRNTI_DL_GRANT } pdcch_to_crnti_received;

View File

@ -63,13 +63,10 @@ void ra_proc::init(phy_interface_mac_lte* phy_h_,
srslte_softbuffer_rx_init(&softbuffer_rar, 10);
pthread_mutex_init(&mutex, NULL);
reset();
}
ra_proc::~ra_proc() {
pthread_mutex_destroy(&mutex);
srslte_softbuffer_rx_free(&softbuffer_rar);
}
@ -88,16 +85,15 @@ void ra_proc::start_pcap(srslte::mac_pcap* pcap_)
void ra_proc::set_config(srsue::mac_interface_rrc::rach_cfg_t& rach_cfg)
{
pthread_mutex_lock(&mutex);
std::unique_lock<std::mutex> ul(mutex);
new_cfg = rach_cfg;
pthread_mutex_unlock(&mutex);
}
void ra_proc::read_params()
{
pthread_mutex_lock(&mutex);
mutex.lock();
rach_cfg = new_cfg;
pthread_mutex_unlock(&mutex);
mutex.unlock();
// Read initialization parameters
if (noncontention_enabled) {