summaryrefslogtreecommitdiff
path: root/AK/Weakable.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-31 12:40:30 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-31 16:19:23 +0100
commit51e5cc4e13f2577534f0263d372ea54389945a8e (patch)
tree5786511488527d7ee422eece0eeec74b8a2c9b29 /AK/Weakable.h
parent30fcb07fe80805b8b76ee1c6c7487f94e07a49b5 (diff)
downloadserenity-51e5cc4e13f2577534f0263d372ea54389945a8e.zip
AK: Remove thread safety gunk from userspace WeakPtr
The implicit thread safety stuff is only needed by the kernel version of WeakPtr, as userspace already makes no guarantees about this.
Diffstat (limited to 'AK/Weakable.h')
-rw-r--r--AK/Weakable.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/Weakable.h b/AK/Weakable.h
index 1e246563e2..c3ee850520 100644
--- a/AK/Weakable.h
+++ b/AK/Weakable.h
@@ -113,7 +113,9 @@ protected:
~Weakable()
{
+#ifdef KERNEL
m_being_destroyed.store(true, AK::MemoryOrder::memory_order_release);
+#endif
revoke_weak_ptrs();
}
@@ -125,7 +127,9 @@ protected:
private:
mutable RefPtr<WeakLink> m_link;
+#ifdef KERNEL
Atomic<bool> m_being_destroyed { false };
+#endif
};
}