MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_ref_put

Function rt_ref_put

components/utilities/libadt/ref/ref.h:54–64  ·  view source on GitHub ↗

* ref_put * decrement reference counter for object. * If the reference counter is zero, call release(). * * Return 1 means the object's reference counter is zero and release() is called. */

Source from the content-addressed store, hash-verified

52 * Return 1 means the object's reference counter is zero and release() is called.
53 */
54rt_inline int rt_ref_put(struct rt_ref *r, void (*release)(struct rt_ref *r))
55{
56 if (rt_atomic_dec_and_test(&r->refcount))
57 {
58 release(r);
59
60 return 1;
61 }
62
63 return 0;
64}
65
66/**
67 * ref_get_unless_zero - Increment refcount for object unless it is zero.

Callers 6

rt_pci_ep_putFunction · 0.85
rt_ofw_node_putFunction · 0.85
clk_putFunction · 0.85
gicv3_its_irq_free_msiFunction · 0.85
rt_regulator_putFunction · 0.85

Calls 1

rt_atomic_dec_and_testFunction · 0.85

Tested by

no test coverage detected