stos: ob: Atomically decrement reference count
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
+2
-3
@@ -10,6 +10,7 @@
|
|||||||
#include <ex/pool.h>
|
#include <ex/pool.h>
|
||||||
#include <ob/cache.h>
|
#include <ob/cache.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <atomic.h>
|
||||||
|
|
||||||
ST_STATUS
|
ST_STATUS
|
||||||
ObCreateDirectory(const CHAR *Name, ST_OBJECT **Result)
|
ObCreateDirectory(const CHAR *Name, ST_OBJECT **Result)
|
||||||
@@ -93,9 +94,7 @@ ObReclaimObject(ST_OBJECT *Object)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Decrement this atomically */
|
if (AtomicDecLong(&Object->RefCount) == 0) {
|
||||||
Object->RefCount -= 1;
|
|
||||||
if (Object->RefCount == 0) {
|
|
||||||
ObReclaimToCache(&gObCache, Object);
|
ObReclaimToCache(&gObCache, Object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user