File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * GPLv2 Open Source. Use is subject to license terms.
55 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66 *
7- * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
7+ * Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
88 *
99 */
1010#include " lookups/ChannelLookup.h"
1111#include " Log.h"
1212
1313using namespace lookups ;
1414
15+ // ---------------------------------------------------------------------------
16+ // Static Class Members
17+ // ---------------------------------------------------------------------------
18+
19+ std::mutex ChannelLookup::m_mutex;
20+
1521// ---------------------------------------------------------------------------
1622// Public Class Members
1723// ---------------------------------------------------------------------------
@@ -51,6 +57,7 @@ VoiceChData ChannelLookup::getRFChData(uint32_t chNo) const
5157
5258bool ChannelLookup::addRFCh (uint32_t chNo, bool force)
5359{
60+ std::lock_guard<std::mutex> lock (m_mutex);
5461 if (chNo == 0U ) {
5562 return false ;
5663 }
@@ -73,16 +80,16 @@ bool ChannelLookup::addRFCh(uint32_t chNo, bool force)
7380
7481bool ChannelLookup::removeRFCh (uint32_t chNo)
7582{
83+ std::lock_guard<std::mutex> lock (m_mutex);
7684 if (chNo == 0U ) {
7785 return false ;
7886 }
7987
80- try {
81- auto it = std::find ( m_rfChTable.begin (), m_rfChTable. end (), chNo);
88+ auto it = std::find (m_rfChTable. begin (), m_rfChTable. end (), chNo);
89+ if ( it != m_rfChTable.end ()) {
8290 m_rfChTable.erase (it);
83- } catch (...) {
84- return false ;
91+ return true ;
8592 }
8693
87- return true ;
94+ return false ;
8895}
Original file line number Diff line number Diff line change 77* @package DVM / Common Library
88* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
99*
10- * Copyright (C) 2024 Bryan Biedenkapp, N2PLL
10+ * Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
1111*
1212*/
1313/* *
3131#include < algorithm>
3232#include < vector>
3333#include < functional>
34+ #include < mutex>
3435
3536namespace lookups
3637{
@@ -219,6 +220,8 @@ namespace lookups
219220 private:
220221 std::vector<uint32_t > m_rfChTable;
221222 std::unordered_map<uint32_t , VoiceChData> m_rfChDataTable;
223+
224+ static std::mutex m_mutex;
222225 };
223226} // namespace lookups
224227
You can’t perform that action at this time.
0 commit comments