Skip to content

Commit c5b0c42

Browse files
authored
Merge pull request #10738 from jimingham/no-lock-loading-script-resource
Don't hold the Target's ModuleListLock over running LoadScriptingReso…
2 parents 1ae6362 + 7837a1b commit c5b0c42

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lldb/source/Core/ModuleList.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,8 +1304,14 @@ bool ModuleList::LoadScriptingResourcesInTarget(Target *target,
13041304
bool continue_on_error) {
13051305
if (!target)
13061306
return false;
1307-
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
1308-
for (auto module : m_modules) {
1307+
m_modules_mutex.lock();
1308+
// Don't hold the module list mutex while loading the scripting resources,
1309+
// The initializer might do any amount of work, and having that happen while
1310+
// the module list is held is asking for A/B locking problems.
1311+
const ModuleList tmp_module_list(*this);
1312+
m_modules_mutex.unlock();
1313+
1314+
for (auto module : tmp_module_list.ModulesNoLocking()) {
13091315
if (module) {
13101316
Status error;
13111317
if (!module->LoadScriptingResourceInTarget(target, error,

0 commit comments

Comments
 (0)