properly mutex lock in AffiliationLookup; add more mutex locking in ChannelLookup;

pull/85/head
Bryan Biedenkapp 10 months ago
parent 9af5c6b2bc
commit 9ed3312438

@ -299,11 +299,12 @@ bool AffiliationLookup::grantCh(uint32_t dstId, uint32_t srcId, uint32_t grantTi
return false; return false;
} }
std::lock_guard<std::mutex> lock(m_mutex);
if (!m_chLookup->isRFChAvailable()) { if (!m_chLookup->isRFChAvailable()) {
return false; return false;
} }
std::lock_guard<std::mutex> lock(m_mutex);
uint32_t chNo = m_chLookup->getFirstRFChannel(); uint32_t chNo = m_chLookup->getFirstRFChannel();
if (!m_chLookup->removeRFCh(chNo)) { if (!m_chLookup->removeRFCh(chNo)) {
return false; return false;
@ -336,6 +337,7 @@ void AffiliationLookup::touchGrant(uint32_t dstId)
} }
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (isGranted(dstId)) { if (isGranted(dstId)) {
m_grantTimers[dstId].start(); m_grantTimers[dstId].start();
} }
@ -431,6 +433,8 @@ bool AffiliationLookup::isChBusy(uint32_t chNo) const
bool AffiliationLookup::isGranted(uint32_t dstId) const bool AffiliationLookup::isGranted(uint32_t dstId) const
{ {
std::lock_guard<std::mutex> lock(m_mutex);
if (dstId == 0U) { if (dstId == 0U) {
return false; return false;
} }
@ -453,6 +457,8 @@ bool AffiliationLookup::isGranted(uint32_t dstId) const
bool AffiliationLookup::isGroup(uint32_t dstId) const bool AffiliationLookup::isGroup(uint32_t dstId) const
{ {
std::lock_guard<std::mutex> lock(m_mutex);
if (dstId == 0U) { if (dstId == 0U) {
return true; return true;
} }
@ -470,6 +476,8 @@ bool AffiliationLookup::isGroup(uint32_t dstId) const
bool AffiliationLookup::isNetGranted(uint32_t dstId) const bool AffiliationLookup::isNetGranted(uint32_t dstId) const
{ {
std::lock_guard<std::mutex> lock(m_mutex);
if (dstId == 0U) { if (dstId == 0U) {
return false; return false;
} }

@ -39,6 +39,8 @@ ChannelLookup::~ChannelLookup() = default;
VoiceChData ChannelLookup::getRFChData(uint32_t chNo) const VoiceChData ChannelLookup::getRFChData(uint32_t chNo) const
{ {
std::lock_guard<std::mutex> lock(m_mutex);
if (chNo == 0U) { if (chNo == 0U) {
return VoiceChData(); return VoiceChData();
} }
@ -58,6 +60,7 @@ VoiceChData ChannelLookup::getRFChData(uint32_t chNo) const
bool ChannelLookup::addRFCh(uint32_t chNo, bool force) bool ChannelLookup::addRFCh(uint32_t chNo, bool force)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (chNo == 0U) { if (chNo == 0U) {
return false; return false;
} }
@ -81,6 +84,7 @@ bool ChannelLookup::addRFCh(uint32_t chNo, bool force)
bool ChannelLookup::removeRFCh(uint32_t chNo) bool ChannelLookup::removeRFCh(uint32_t chNo)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(m_mutex);
if (chNo == 0U) { if (chNo == 0U) {
return false; return false;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.