#ifndef _NUCLEUS_OBJECT_H #define _NUCLEUS_OBJECT_H #include #include typedef struct ObjectType ObjectType; struct Object; typedef struct Object Object; typedef struct Spinlock Spinlock; typedef struct Task Task; /* Just a pointer, no need for full definition */ /* Spinlock */ struct Spinlock { char locked; refcount_t usage; union { Task *owner; cpu_t cpu; }; }; /* Object Type */ struct ObjectType { unsigned int count; refcount_t usage; void *(*new)(void); void (*delete)(Object *); }; /* Object */ struct Object { ObjectType *type; refcount_t usage; Spinlock lock; }; void *get(void *addr); void put(void *addr); void *new(ObjectType *type); void lock(void *addr); void unlock(void *addr); #endif