@@ -193,10 +193,11 @@ uint32_t SBProcess::GetNumThreads() {
193193 if (process_sp) {
194194 Process::StopLocker stop_locker;
195195
196- const bool can_update = stop_locker.TryLock (&process_sp->GetRunLock ());
197- std::lock_guard<std::recursive_mutex> guard (
198- process_sp->GetTarget ().GetAPIMutex ());
199- num_threads = process_sp->GetThreadList ().GetSize (can_update);
196+ if (stop_locker.TryLock (&process_sp->GetRunLock ())) {
197+ std::lock_guard<std::recursive_mutex> guard (
198+ process_sp->GetTarget ().GetAPIMutex ());
199+ num_threads = process_sp->GetThreadList ().GetSize ();
200+ }
200201 }
201202
202203 return num_threads;
@@ -393,11 +394,12 @@ SBThread SBProcess::GetThreadAtIndex(size_t index) {
393394 ProcessSP process_sp (GetSP ());
394395 if (process_sp) {
395396 Process::StopLocker stop_locker;
396- const bool can_update = stop_locker.TryLock (&process_sp->GetRunLock ());
397- std::lock_guard<std::recursive_mutex> guard (
398- process_sp->GetTarget ().GetAPIMutex ());
399- thread_sp = process_sp->GetThreadList ().GetThreadAtIndex (index, can_update);
400- sb_thread.SetThread (thread_sp);
397+ if (stop_locker.TryLock (&process_sp->GetRunLock ())) {
398+ std::lock_guard<std::recursive_mutex> guard (
399+ process_sp->GetTarget ().GetAPIMutex ());
400+ thread_sp = process_sp->GetThreadList ().GetThreadAtIndex (index, false );
401+ sb_thread.SetThread (thread_sp);
402+ }
401403 }
402404
403405 return sb_thread;
0 commit comments