@@ -531,8 +531,7 @@ bool ThreadList::WillResume() {
531
531
// There are two special kinds of thread that have priority for "StopOthers":
532
532
// a "ShouldRunBeforePublicStop thread, or the currently selected thread. If
533
533
// we find one satisfying that critereon, put it here.
534
- ThreadSP stop_others_thread_sp;
535
-
534
+ ThreadSP thread_to_run;
536
535
for (pos = m_threads.begin (); pos != end; ++pos) {
537
536
ThreadSP thread_sp (*pos);
538
537
if (thread_sp->GetResumeState () != eStateSuspended &&
@@ -546,21 +545,18 @@ bool ThreadList::WillResume() {
546
545
run_me_only_list.AddThread (thread_sp);
547
546
548
547
if (thread_sp == GetSelectedThread ())
549
- stop_others_thread_sp = thread_sp;
550
-
548
+ thread_to_run = thread_sp;
549
+
551
550
if (thread_sp->ShouldRunBeforePublicStop ()) {
552
551
// 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;
554
553
break ;
555
554
}
556
555
}
557
556
}
558
557
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 ) {
564
560
thread_to_run = run_me_only_list.GetThreadAtIndex (0 );
565
561
} else {
566
562
int random_thread =
0 commit comments