10 FILE_LICENCE ( GPL2_OR_LATER
);
15 * This data structure is designed to be embedded within a
16 * reference-counted object.
18 * Reference-counted objects are freed when their reference count
19 * drops below zero. This means that a freshly allocated-and-zeroed
20 * reference-counted object will be freed on the first call to
24 /** Current reference count
26 * When this count is decremented below zero, the free()
27 * method will be called.
30 /** Free containing object
32 * This method is called when the reference count is
33 * decremented below zero.
35 * If this method is left NULL, the standard library free()
36 * function will be called. The upshot of this is that you
37 * may omit the free() method if the @c refcnt object is the
38 * first element of your reference-counted struct.
40 void ( * free
) ( struct refcnt
*refcnt
);
43 extern struct refcnt
* ref_get ( struct refcnt
*refcnt
);
44 extern void ref_put ( struct refcnt
*refcnt
);
46 #endif /* _GPXE_REFCNT_H */