mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:27:35 +00:00
AK+Kernel: Add AK::AtomicRefCounted and use everywhere in the kernel
Instead of having two separate implementations of AK::RefCounted, one for userspace and one for kernelspace, there is now RefCounted and AtomicRefCounted.
This commit is contained in:
parent
4889eb019a
commit
e475263113
45 changed files with 81 additions and 94 deletions
|
@ -6,15 +6,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/Library/ThreadSafeRefCounted.h>
|
||||
#else
|
||||
|
||||
# include <AK/Assertions.h>
|
||||
# include <AK/Checked.h>
|
||||
# include <AK/Noncopyable.h>
|
||||
# include <AK/Platform.h>
|
||||
# include <AK/StdLibExtras.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Checked.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
@ -67,7 +63,7 @@ public:
|
|||
if (new_ref_count == 0) {
|
||||
if constexpr (requires { that->will_be_destroyed(); })
|
||||
that->will_be_destroyed();
|
||||
delete static_cast<const T*>(this);
|
||||
delete static_cast<T const*>(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -78,5 +74,3 @@ public:
|
|||
|
||||
using AK::RefCounted;
|
||||
using AK::RefCountedBase;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue