stos: ob: Add object cache groundwork
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user