upipe/urefcount.h header reference
Upipe thread-safe reference counting More
Header inclusion
Members
Types
- struct urefcount
- typedef void (*urefcount_cb)(struct urefcount *)
Functions
- void urefcount_clean(struct urefcount *refcount)
- bool urefcount_dead(struct urefcount *refcount)
- void urefcount_init(struct urefcount *refcount, urefcount_cb cb)
- void urefcount_release(struct urefcount *refcount)
- void urefcount_reset(struct urefcount *refcount)
- bool urefcount_single(struct urefcount *refcount)
- struct urefcount * urefcount_use(struct urefcount *refcount)
Description
Members detail
This macro is declared in upipe/urefcount.h source file, line 31.
This struct is declared in upipe/urefcount.h source file, line 50.
This struct defines an object with reference counting.
Field | Description |
---|---|
uatomic_uint32_t refcount; | number of pointers to the parent object |
urefcount_cb cb; | function called when the refcount goes down to 0 |
typedef void (*urefcount_cb)(struct urefcount *)
This typedef is declared in upipe/urefcount.h source file, line 47.
This typedef is a function pointer freeing a structure.
void urefcount_clean(struct urefcount *refcount)
This function is declared in upipe/urefcount.h source file, line 134.
This function cleans up the urefcount structure.
Parameters list:
- refcount: pointer to a urefcount structure
bool urefcount_dead(struct urefcount *refcount)
This function is declared in upipe/urefcount.h source file, line 124.
This function checks for no reference.
Parameters list:
- refcount: pointer to a urefcount structure
The return value is true if there is no reference to the object
void urefcount_init(struct urefcount *refcount, urefcount_cb cb)
This function is declared in upipe/urefcount.h source file, line 64.
This function initializes a urefcount. It must be executed before any other call to the refcount structure.
Parameters list:
- refcount: pointer to a urefcount structure
- cb: function called when the refcount goes down to 0 (may be NULL)
void urefcount_release(struct urefcount *refcount)
This function is declared in upipe/urefcount.h source file, line 98.
This function decrements a reference counter, and possibly frees the object if the refcount goes down to 0.
Parameters list:
- refcount: pointer to a urefcount structure
void urefcount_reset(struct urefcount *refcount)
This function is declared in upipe/urefcount.h source file, line 75.
This function resets a urefcount to 1.
Parameters list:
- refcount: pointer to a urefcount structure
bool urefcount_single(struct urefcount *refcount)
This function is declared in upipe/urefcount.h source file, line 113.
This function checks for more than one reference.
Parameters list:
- refcount: pointer to a urefcount structure
The return value is true if there is only one reference to the object
This function is declared in upipe/urefcount.h source file, line 86.
This function increments a reference counter.
Parameters list:
- refcount: pointer to a urefcount structure
The return value is same pointer to a urefcount structure