@@ -702,7 +702,7 @@ static void ReportUnsuspendedThreads(const SuspendedThreadsList &) {}
702702
703703# else // !SANITIZER_FUCHSIA
704704
705- static void ReportUnsuspendedThreads (
705+ static bool ReportUnsuspendedThreads (
706706 const SuspendedThreadsList &suspended_threads) {
707707 InternalMmapVector<tid_t > threads (suspended_threads.ThreadCount ());
708708 for (uptr i = 0 ; i < suspended_threads.ThreadCount (); ++i)
@@ -713,13 +713,17 @@ static void ReportUnsuspendedThreads(
713713 InternalMmapVector<tid_t > unsuspended;
714714 GetRunningThreadsLocked (&unsuspended);
715715
716+ bool succeded = true ;
716717 for (auto os_id : unsuspended) {
717718 uptr i = InternalLowerBound (threads, os_id);
718- if (i >= threads.size () || threads[i] != os_id)
719+ if (i >= threads.size () || threads[i] != os_id) {
720+ succeded = false ;
719721 Report (
720722 " Running thread %zu was not suspended. False leaks are possible.\n " ,
721723 os_id);
724+ }
722725 }
726+ return succeded;
723727}
724728
725729# endif // !SANITIZER_FUCHSIA
@@ -729,7 +733,18 @@ static void CheckForLeaksCallback(const SuspendedThreadsList &suspended_threads,
729733 CheckForLeaksParam *param = reinterpret_cast <CheckForLeaksParam *>(arg);
730734 CHECK (param);
731735 CHECK (!param->success );
732- ReportUnsuspendedThreads (suspended_threads);
736+ if (!ReportUnsuspendedThreads (suspended_threads)) {
737+ switch (flags ()->thread_suspend_fail ) {
738+ case 0 :
739+ param->success = true ;
740+ return ;
741+ case 1 :
742+ break ;
743+ case 2 :
744+ // Will crash on return.
745+ return ;
746+ }
747+ }
733748 ClassifyAllChunks (suspended_threads, ¶m->frontier , param->caller_tid ,
734749 param->caller_sp );
735750 ForEachChunk (CollectLeaksCb, ¶m->leaks );
0 commit comments