stos: ob: Add object cache groundwork

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-25 17:50:43 +00:00
parent 70f58b193f
commit bc11f9b58f
5 changed files with 155 additions and 1 deletions
+15
View File
@@ -8,6 +8,7 @@
#include <ob/object.h>
#include <ex/pool.h>
#include <ob/cache.h>
#include <string.h>
ST_STATUS
@@ -84,3 +85,17 @@ ObCreateObject(const CHAR *Name, OBJECT_TYPE Type, VOID *Data, ST_OBJECT **Resul
*Result = Object;
return STATUS_SUCCESS;
}
VOID
ObReclaimObject(ST_OBJECT *Object)
{
if (Object == NULL) {
return;
}
/* TODO: Decrement this atomically */
Object->RefCount -= 1;
if (Object->RefCount == 0) {
ObReclaimToCache(&gObCache, Object);
}
}