![]() |
PokerUnicorn
|
Atomic reference counting for thread-safe reference counting. More...
Data Structures | |
struct | pkrsrv_ref_counted_t |
Reference-counted object structure. More... | |
Macros | |
#define | PKRSRV_REF_COUNTEDIFY() pkrsrv_ref_counted_t ref_counted; |
Makes a structure reference-counted. | |
Functions | |
void | pkrsrv_ref_counted_t::pkrsrv_ref_counted_init (pkrsrv_ref_counted_t *ref_counted, pkrsrv_ref_free_f_t free_f) |
Initializes a reference-counted object. Should be called in the constructor of the object after the dynamic allocation. | |
void | pkrsrv_ref_counted_t::pkrsrv_ref_counted_use (pkrsrv_ref_counted_t *ref_counted) |
Increments the reference count of a reference-counted object. | |
void | pkrsrv_ref_counted_t::pkrsrv_ref_counted_leave (void **obj_vp, pkrsrv_ref_counted_t *ref_counted) |
Decrements the reference count of a reference-counted object. | |
Atomic reference counting for thread-safe reference counting.
struct pkrsrv_ref_counted |
Reference-counted object structure.
Public Member Functions | |
#define | PKRSRV_REF_COUNTED_INIT(obj, free_f) pkrsrv_ref_counted_init(&(obj->ref_counted), (pkrsrv_ref_free_f_t) free_f); |
Initializes a reference-counted object. Should be called in the constructor of the object after the dynamic allocation. | |
#define | PKRSRV_REF_COUNTED_USE(obj) |
Increments the reference count of a reference-counted object. | |
#define | PKRSRV_REF_COUNTED_LEAVE(obj) |
Decrements the reference count of a reference-counted object. | |
Data Fields | |
int | count |
pkrsrv_ref_free_f_t | free_f |
pthread_mutex_t | mutex |
Protected Member Functions | |
void | pkrsrv_ref_counted_init (pkrsrv_ref_counted_t *ref_counted, pkrsrv_ref_free_f_t free_f) |
Initializes a reference-counted object. Should be called in the constructor of the object after the dynamic allocation. | |
void | pkrsrv_ref_counted_use (pkrsrv_ref_counted_t *ref_counted) |
Increments the reference count of a reference-counted object. | |
void | pkrsrv_ref_counted_leave (void **obj_vp, pkrsrv_ref_counted_t *ref_counted) |
Decrements the reference count of a reference-counted object. | |
int pkrsrv_ref_counted_t::count |
pkrsrv_ref_free_f_t pkrsrv_ref_counted_t::free_f |
pthread_mutex_t pkrsrv_ref_counted_t::mutex |
#define PKRSRV_REF_COUNTEDIFY | ( | ) | pkrsrv_ref_counted_t ref_counted; |
Makes a structure reference-counted.
|
protected |
Initializes a reference-counted object. Should be called in the constructor of the object after the dynamic allocation.
|
protected |
Increments the reference count of a reference-counted object.
|
protected |
Decrements the reference count of a reference-counted object.