Kernel: Make ListedRefCounted::unref() call optional list removal helper

Look for remove_from_secondary_lists() and call it on the ref-counting
target if present *while the lock is held*.

This allows listed-ref-counted objects to be present in multiple lists
and still have synchronized removal on final unref.
This commit is contained in:
Andreas Kling 2022-01-11 00:49:00 +01:00
commit 3550f12543
Notes: sideshowbarker 2024-07-17 21:13:05 +09:00

View file

@ -34,6 +34,8 @@ public:
if constexpr (requires { that->revoke_weak_ptrs(); }) {
that->revoke_weak_ptrs();
}
if constexpr (requires { that->remove_from_secondary_lists(); })
that->remove_from_secondary_lists();
}
return new_ref_count;
};