Skip to content

Commit d58dc9f

Browse files
Add lock annotations (cs_args)
1 parent db5e9d3 commit d58dc9f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class ArgsManagerHelper {
216216

217217
/** Determine whether to use config settings in the default section,
218218
* See also comments around ArgsManager::ArgsManager() below. */
219-
static inline bool UseDefaultSection(const ArgsManager& am, const std::string& arg)
219+
static inline bool UseDefaultSection(const ArgsManager& am, const std::string& arg) EXCLUSIVE_LOCKS_REQUIRED(am.cs_args)
220220
{
221221
return (am.m_network == CBaseChainParams::MAIN || am.m_network_only_args.count(arg) == 0);
222222
}
@@ -295,7 +295,7 @@ class ArgsManagerHelper {
295295
/* Special test for -testnet and -regtest args, because we
296296
* don't want to be confused by craziness like "[regtest] testnet=1"
297297
*/
298-
static inline bool GetNetBoolArg(const ArgsManager &am, const std::string& net_arg)
298+
static inline bool GetNetBoolArg(const ArgsManager &am, const std::string& net_arg) EXCLUSIVE_LOCKS_REQUIRED(am.cs_args)
299299
{
300300
std::pair<bool,std::string> found_result(false,std::string());
301301
found_result = GetArgHelper(am.m_override_args, net_arg, true);

src/util.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ class ArgsManager
142142
};
143143

144144
mutable CCriticalSection cs_args;
145-
std::map<std::string, std::vector<std::string>> m_override_args;
146-
std::map<std::string, std::vector<std::string>> m_config_args;
147-
std::string m_network;
148-
std::set<std::string> m_network_only_args;
149-
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args;
145+
std::map<std::string, std::vector<std::string>> m_override_args GUARDED_BY(cs_args);
146+
std::map<std::string, std::vector<std::string>> m_config_args GUARDED_BY(cs_args);
147+
std::string m_network GUARDED_BY(cs_args);
148+
std::set<std::string> m_network_only_args GUARDED_BY(cs_args);
149+
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
150150

151151
bool ReadConfigStream(std::istream& stream, std::string& error, bool ignore_invalid_keys = false);
152152

0 commit comments

Comments
 (0)