Renamed lock_guard (lg) to lock

This commit is contained in:
Xavier Arteaga 2019-10-01 12:14:24 +02:00 committed by Andre Puschmann
parent 665f899a74
commit efdec15964
3 changed files with 10 additions and 11 deletions

View File

@ -221,7 +221,7 @@ private:
*/ */
state_t run_state() state_t run_state()
{ {
std::lock_guard<std::mutex> lg(inside); std::lock_guard<std::mutex> lock(inside);
cur_state = next_state; cur_state = next_state;
if (state_setting) { if (state_setting) {
state_setting = false; state_setting = false;
@ -234,7 +234,7 @@ private:
// Called by the main thread at the end of each state to indicate it has finished. // Called by the main thread at the end of each state to indicate it has finished.
void state_exit(bool exit_ok = true) void state_exit(bool exit_ok = true)
{ {
std::lock_guard<std::mutex> lg(inside); std::lock_guard<std::mutex> lock(inside);
if (cur_state == SFN_SYNC && exit_ok == true) { if (cur_state == SFN_SYNC && exit_ok == true) {
next_state = CAMPING; next_state = CAMPING;
} else { } else {
@ -245,7 +245,7 @@ private:
} }
void force_sfn_sync() void force_sfn_sync()
{ {
std::lock_guard<std::mutex> lg(inside); std::lock_guard<std::mutex> lock(inside);
next_state = SFN_SYNC; next_state = SFN_SYNC;
} }
@ -256,19 +256,19 @@ private:
*/ */
void go_idle() void go_idle()
{ {
std::lock_guard<std::mutex> lg(outside); std::lock_guard<std::mutex> lock(outside);
go_state(IDLE); go_state(IDLE);
} }
void run_cell_search() void run_cell_search()
{ {
std::lock_guard<std::mutex> lg(outside); std::lock_guard<std::mutex> lock(outside);
go_state(CELL_SEARCH); go_state(CELL_SEARCH);
wait_state_run(); wait_state_run();
wait_state_next(); wait_state_next();
} }
void run_sfn_sync() void run_sfn_sync()
{ {
std::lock_guard<std::mutex> lg(outside); std::lock_guard<std::mutex> lock(outside);
go_state(SFN_SYNC); go_state(SFN_SYNC);
wait_state_run(); wait_state_run();
wait_state_next(); wait_state_next();

View File

@ -789,7 +789,6 @@ bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
uint32_t frame_alloc_idx = sfn % enum_to_number(mcch.common_sf_alloc_period); uint32_t frame_alloc_idx = sfn % enum_to_number(mcch.common_sf_alloc_period);
uint32_t sf_alloc_idx = frame_alloc_idx * mbsfn_per_frame + ((sf < 4) ? sf - 1 : sf - 3); uint32_t sf_alloc_idx = frame_alloc_idx * mbsfn_per_frame + ((sf < 4) ? sf - 1 : sf - 3);
std::unique_lock<std::mutex> lock(mtch_mutex); std::unique_lock<std::mutex> lock(mtch_mutex);
lock.lock();
while (!have_mtch_stop) { while (!have_mtch_stop) {
mtch_cvar.wait(lock); mtch_cvar.wait(lock);
} }

View File

@ -80,7 +80,7 @@ sf_worker::~sf_worker()
void sf_worker::reset() void sf_worker::reset()
{ {
std::lock_guard<std::mutex> lg(mutex); std::lock_guard<std::mutex> lock(mutex);
rssi_read_cnt = 0; rssi_read_cnt = 0;
for (auto& cc_worker : cc_workers) { for (auto& cc_worker : cc_workers) {
cc_worker->reset(); cc_worker->reset();
@ -90,7 +90,7 @@ void sf_worker::reset()
bool sf_worker::set_cell(uint32_t cc_idx, srslte_cell_t cell_) bool sf_worker::set_cell(uint32_t cc_idx, srslte_cell_t cell_)
{ {
bool ret = false; bool ret = false;
std::lock_guard<std::mutex> lg(mutex); std::lock_guard<std::mutex> lock(mutex);
if (cc_idx < cc_workers.size()) { if (cc_idx < cc_workers.size()) {
if (!cc_workers[cc_idx]->set_cell(cell_)) { if (!cc_workers[cc_idx]->set_cell(cell_)) {
@ -173,7 +173,7 @@ void sf_worker::enable_pregen_signals(bool enabled)
void sf_worker::set_config(uint32_t cc_idx, srslte::phy_cfg_t& phy_cfg) void sf_worker::set_config(uint32_t cc_idx, srslte::phy_cfg_t& phy_cfg)
{ {
std::lock_guard<std::mutex> lg(mutex); std::lock_guard<std::mutex> lock(mutex);
if (cc_idx < cc_workers.size()) { if (cc_idx < cc_workers.size()) {
Info("Setting configuration for cc_worker=%d, cc=%d\n", get_id(), cc_idx); Info("Setting configuration for cc_worker=%d, cc=%d\n", get_id(), cc_idx);
cc_workers[cc_idx]->set_config(phy_cfg); cc_workers[cc_idx]->set_config(phy_cfg);
@ -184,7 +184,7 @@ void sf_worker::set_config(uint32_t cc_idx, srslte::phy_cfg_t& phy_cfg)
void sf_worker::work_imp() void sf_worker::work_imp()
{ {
std::lock_guard<std::mutex> lg(mutex); std::lock_guard<std::mutex> lock(mutex);
if (!cell_initiated) { if (!cell_initiated) {
return; return;
} }