@@ -531,8 +531,7 @@ bool ThreadList::WillResume() {
531531 // There are two special kinds of thread that have priority for "StopOthers":
532532 // a "ShouldRunBeforePublicStop thread, or the currently selected thread. If
533533 // we find one satisfying that critereon, put it here.
534- ThreadSP stop_others_thread_sp;
535-
534+ ThreadSP thread_to_run;
536535 for (pos = m_threads.begin (); pos != end; ++pos) {
537536 ThreadSP thread_sp (*pos);
538537 if (thread_sp->GetResumeState () != eStateSuspended &&
@@ -546,21 +545,18 @@ bool ThreadList::WillResume() {
546545 run_me_only_list.AddThread (thread_sp);
547546
548547 if (thread_sp == GetSelectedThread ())
549- stop_others_thread_sp = thread_sp;
550-
548+ thread_to_run = thread_sp;
549+
551550 if (thread_sp->ShouldRunBeforePublicStop ()) {
552551 // This takes precedence, so if we find one of these, service it:
553- stop_others_thread_sp = thread_sp;
552+ thread_to_run = thread_sp;
554553 break ;
555554 }
556555 }
557556 }
558557
559- ThreadSP thread_to_run;
560- if (run_me_only_list.GetSize (false ) > 0 ) {
561- if (stop_others_thread_sp) {
562- thread_to_run = stop_others_thread_sp;
563- } else if (run_me_only_list.GetSize (false ) == 1 ) {
558+ if (run_me_only_list.GetSize (false ) > 0 && !thread_to_run) {
559+ if (run_me_only_list.GetSize (false ) == 1 ) {
564560 thread_to_run = run_me_only_list.GetThreadAtIndex (0 );
565561 } else {
566562 int random_thread =
0 commit comments