mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
Kernel: Port Custody to ListedRefCounted
Custody's unref is one of many implementions of ListedRefCounted's behaviour in the Kernel, which results in avoidable bugs caused by the fragmentation of the implementations. This commit starts the work of replacing all custom implementations with ListedRefCounted by porting Custody to it.
This commit is contained in:
parent
be91b4fe3e
commit
81e23617d6
2 changed files with 8 additions and 23 deletions
|
@ -8,20 +8,19 @@
|
|||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/IntrusiveList.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KString.h>
|
||||
#include <Kernel/Library/ListedRefCounted.h>
|
||||
#include <Kernel/Locking/MutexProtected.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
// FIXME: Custody needs some locking.
|
||||
|
||||
class Custody : public RefCountedBase {
|
||||
class Custody : public ListedRefCounted<Custody, LockType::Mutex> {
|
||||
public:
|
||||
bool unref() const;
|
||||
|
||||
static ErrorOr<NonnullRefPtr<Custody>> try_create(Custody* parent, StringView name, Inode&, int mount_flags);
|
||||
|
||||
~Custody();
|
||||
|
@ -49,6 +48,7 @@ private:
|
|||
|
||||
public:
|
||||
using AllCustodiesList = IntrusiveList<&Custody::m_all_custodies_list_node>;
|
||||
static MutexProtected<Custody::AllCustodiesList>& all_instances();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue