#include <kernel/defs.h>
#include <assert.h>
#include <stdatomic.h>
#include <stdint.h>
Go to the source code of this file.
|
| #define | REF_MAGIC 0x26CB6E4C |
| | Magic value used in debug builds to check for corruption or invalid use of the ref_t structure.
|
| |
| #define | DEREF_DEFER(ptr) __attribute__((cleanup(ref_defer_cleanup))) void* CONCAT(p, __COUNTER__) = (ptr) |
| | RAII-style cleanup for scoped references.
|
| |
| #define | REF(ptr) |
| | Increment reference count.
|
| |
| #define | DEREF(ptr) |
| | Decrement reference count.
|
| |
|
| static void | ref_init (ref_t *ref, void *free) |
| | Initialize a reference counter.
|
| |
| static void * | ref_inc (void *ptr) |
| | Increment reference count.
|
| |
| static void | ref_dec (void *ptr) |
| | Decrement reference count.
|
| |
| static void | ref_defer_cleanup (void **ptr) |
| |