From a5348f4bdc95c5a327817b5c62ee9f99ec8a0bfa Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Wed, 19 Mar 2025 16:59:45 +0100 Subject: [PATCH] perf: avoid taking mutex on task deactivation (#7572) --- src/runtime/object.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/runtime/object.cpp b/src/runtime/object.cpp index f03f0de521..eb0e32bb3d 100644 --- a/src/runtime/object.cpp +++ b/src/runtime/object.cpp @@ -926,6 +926,12 @@ public: } void deactivate_task(lean_task_object * t) { + if (object * v = t->m_value) { + lean_assert(t->m_imp == nullptr); + lean_dec(v); + free_task(t); + return; + } unique_lock lock(m_mutex); if (object * v = t->m_value) { lean_assert(t->m_imp == nullptr);