Skip to content

Commit 2f468fc

Browse files
committed
[lldb] Set wants_solo_run based on whether run_me_only_list is empty
We no longer need a dedicated loop to set `wants_solo_run`.
1 parent ee110d5 commit 2f468fc

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

lldb/source/Target/ThreadList.cpp

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -518,30 +518,7 @@ bool ThreadList::WillResume() {
518518

519519
collection::iterator pos, end = m_threads.end();
520520

521-
// See if any thread wants to run stopping others. If it does, then we won't
522-
// setup the other threads for resume, since they aren't going to get a
523-
// chance to run. This is necessary because the SetupForResume might add
524-
// "StopOthers" plans which would then get to be part of the who-gets-to-run
525-
// negotiation, but they're coming in after the fact, and the threads that
526-
// are already set up should take priority.
527-
528-
bool wants_solo_run = false;
529-
530-
for (pos = m_threads.begin(); pos != end; ++pos) {
531-
ThreadSP thread_sp(*pos);
532-
lldbassert(thread_sp->GetCurrentPlan() &&
533-
"thread should not have null thread plan");
534-
if (thread_sp->GetResumeState() != eStateSuspended &&
535-
thread_sp->GetCurrentPlan()->StopOthers()) {
536-
if (thread_sp->IsOperatingSystemPluginThread() &&
537-
!thread_sp->GetBackingThread())
538-
continue;
539-
wants_solo_run = true;
540-
break;
541-
}
542-
}
543-
544-
// Now go through the threads and see if any thread wants to run just itself.
521+
// Go through the threads and see if any thread wants to run just itself.
545522
// if so then pick one and run it.
546523

547524
ThreadList run_me_only_list(m_process);
@@ -583,8 +560,15 @@ bool ThreadList::WillResume() {
583560
// state before we negotiate who is actually going to get a chance to run...
584561
// Don't set to resume suspended threads, and if any thread wanted to stop
585562
// others, only call setup on the threads that request StopOthers...
563+
bool wants_solo_run = run_me_only_list.GetSize(false) > 0;
586564
for (pos = m_threads.begin(); pos != end; ++pos) {
587565
ThreadSP thread_sp(*pos);
566+
// See if any thread wants to run stopping others. If it does, then we
567+
// won't setup the other threads for resume, since they aren't going to get
568+
// a chance to run. This is necessary because the SetupForResume might add
569+
// "StopOthers" plans which would then get to be part of the who-gets-to-run
570+
// negotiation, but they're coming in after the fact, and the threads that
571+
// are already set up should take priority.
588572
if (thread_sp->GetResumeState() != eStateSuspended &&
589573
(!wants_solo_run || thread_sp->GetCurrentPlan()->StopOthers())) {
590574
if (thread_sp->IsOperatingSystemPluginThread() &&

0 commit comments

Comments
 (0)