Kernel: pass ref down to Object and wrap ID counter into kernel state
This commit is contained in:
parent
87426b29ff
commit
751ebe55e9
18 changed files with 31 additions and 22 deletions
|
@ -11,6 +11,8 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
class KernelSystem;
|
||||
|
||||
using Handle = u32;
|
||||
|
||||
enum class HandleType : u32 {
|
||||
|
@ -37,6 +39,7 @@ enum {
|
|||
|
||||
class Object : NonCopyable {
|
||||
public:
|
||||
explicit Object(KernelSystem& kernel);
|
||||
virtual ~Object();
|
||||
|
||||
/// Returns a unique identifier for the object. For debugging purposes only.
|
||||
|
@ -58,15 +61,12 @@ public:
|
|||
*/
|
||||
bool IsWaitable() const;
|
||||
|
||||
public:
|
||||
static std::atomic<u32> next_object_id;
|
||||
|
||||
private:
|
||||
friend void intrusive_ptr_add_ref(Object*);
|
||||
friend void intrusive_ptr_release(Object*);
|
||||
|
||||
std::atomic<u32> ref_count{0};
|
||||
std::atomic<u32> object_id{next_object_id++};
|
||||
std::atomic<u32> object_id;
|
||||
};
|
||||
|
||||
// Special functions used by boost::instrusive_ptr to do automatic ref-counting
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue