Skip to content

Commit e672344

Browse files
committed
Move critical section into AddTargetInternal
1 parent f2d3ad3 commit e672344

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lldb/source/Target/TargetList.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Status TargetList::CreateTarget(Debugger &debugger,
5757
debugger, user_exe_path, triple_str, load_dependent_files,
5858
platform_options, target_sp);
5959

60-
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
6160
if (target_sp && result.Success())
6261
AddTargetInternal(target_sp, /*do_select*/ true);
6362
return result;
@@ -77,7 +76,6 @@ Status TargetList::CreateTarget(Debugger &debugger,
7776
debugger, user_exe_path, specified_arch, load_dependent_files,
7877
platform_sp, target_sp);
7978

80-
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
8179
if (target_sp && result.Success())
8280
AddTargetInternal(target_sp, /*do_select*/ true);
8381
return result;
@@ -531,6 +529,7 @@ uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP target_sp) const {
531529
}
532530

533531
void TargetList::AddTargetInternal(TargetSP target_sp, bool do_select) {
532+
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
534533
lldbassert(!llvm::is_contained(m_target_list, target_sp) &&
535534
"target already exists it the list");
536535
UnregisterInProcessTarget(target_sp);

0 commit comments

Comments
 (0)