diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp index 1d02b81b886f47b8f27a0e6c1bb66e679337699b..515211053ee6a98bab90cdfd39c85a79ac236467 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cpp @@ -558,6 +558,7 @@ void ReportDestroyLocked(ThreadState *thr, uptr pc, uptr addr, Lock slot_lock(&ctx->slots[static_cast(last_lock.sid())].mtx); ThreadRegistryLock l0(&ctx->thread_registry); Lock slots_lock(&ctx->slot_mtx); + bool thr_slocked_status = thr->slot_locked; // OHOS_LOCAL thr->slot_locked = true; // OHOS_LOCAL ScopedReport rep(ReportTypeMutexDestroyLocked); rep.AddMutex(addr, creation_stack_id); @@ -574,7 +575,7 @@ void ReportDestroyLocked(ThreadState *thr, uptr pc, uptr addr, rep.AddStack(trace, true); rep.AddLocation(addr, 1); OutputReport(thr, rep); - thr->slot_locked = false; // OHOS_LOCAL + thr->slot_locked = thr_slocked_status; // OHOS_LOCAL } } // namespace __tsan diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp index 4973b3b0805912a30c1ebf0426a3cb5ccc31d8a0..787cf7ba90a4c24aecdea5419ea4fa221de74211 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cpp @@ -777,6 +777,8 @@ void ReportRace(ThreadState *thr, RawShadow *shadow_mem, Shadow cur, Shadow old, Lock slot_lock(&ctx->slots[static_cast(s[1].sid())].mtx); ThreadRegistryLock l0(&ctx->thread_registry); Lock slots_lock(&ctx->slot_mtx); + bool thr_slocked_status = thr->slot_locked; // OHOS_LOCAL + thr->slot_locked = true; // OHOS_LOCAL if (SpuriousRace(old)) return; if (!RestoreStack(EventType::kAccessExt, s[1].sid(), s[1].epoch(), addr1, @@ -831,6 +833,7 @@ void ReportRace(ThreadState *thr, RawShadow *shadow_mem, Shadow cur, Shadow old, rep.AddSleep(thr->last_sleep_stack_id); #endif OutputReport(thr, rep); + thr->slot_locked = thr_slocked_status; // OHOS_LOCAL } void PrintCurrentStack(ThreadState *thr, uptr pc) {