nas: make state variables atomics

NAS states and substates maybe be requested from other threads so
they need to be protected.

Note that the caller still needs to hold it's own mutex if different
actions are required based on the state.
master
Andre Puschmann 3 years ago
parent 42b052112f
commit 99dc94ab38

@ -75,8 +75,8 @@ public:
private:
std::atomic<state_t> state{state_t::null};
deregistered_substate_t deregistered_substate = deregistered_substate_t::null;
registered_substate_t registered_substate = registered_substate_t::null;
std::atomic<deregistered_substate_t> deregistered_substate{deregistered_substate_t::null};
std::atomic<registered_substate_t> registered_substate{registered_substate_t::null};
srslog::basic_logger& logger = srslog::fetch_basic_logger("NAS-5G");
};
@ -85,4 +85,5 @@ const char* mm5g_deregistered_substate_text(mm5g_state_t::deregistered_substate_
const char* mm5g_registered_substate_text(mm5g_state_t::registered_substate_t type);
} // namespace srsue
#endif

@ -78,8 +78,8 @@ public:
private:
std::atomic<state_t> state{state_t::null}; // The GW might require to know the NAS state from another thread
deregistered_substate_t deregistered_substate = deregistered_substate_t::null;
registered_substate_t registered_substate = registered_substate_t::null;
std::atomic<deregistered_substate_t> deregistered_substate{deregistered_substate_t::null};
std::atomic<registered_substate_t> registered_substate{registered_substate_t::null};
srslog::basic_logger& logger = srslog::fetch_basic_logger("NAS");
};
@ -88,4 +88,5 @@ const char* emm_deregistered_substate_text(emm_state_t::deregistered_substate_t
const char* emm_registered_substate_text(emm_state_t::registered_substate_t type);
} // namespace srsue
#endif

Loading…
Cancel
Save