13 * This data structure is designed to be embedded within a
14 * reference-counted object.
16 * Reference-counted objects are freed when their reference count
17 * drops below zero. This means that a freshly allocated-and-zeroed
18 * reference-counted object will be freed on the first call to
22 /** Current reference count
24 * When this count is decremented below zero, the free()
25 * method will be called.
28 /** Free containing object
30 * This method is called when the reference count is
31 * decremented below zero.
33 * If this method is left NULL, the standard library free()
34 * function will be called. The upshot of this is that you
35 * may omit the free() method if the @c refcnt object is the
36 * first element of your reference-counted struct.
38 void ( * free ) ( struct refcnt *refcnt );
41 extern void ref_get ( struct refcnt *refcnt );
42 extern void ref_put ( struct refcnt *refcnt );
44 #endif /* _GPXE_REFCNT_H */