MCPcopy Create free account
hub / github.com/F-Stack/f-stack / refcount_acquire_if_gt

Function refcount_acquire_if_gt

freebsd/sys/refcount.h:129–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 */
128#endif
129static __inline __result_use_check bool
130refcount_acquire_if_gt(volatile u_int *count, u_int n)
131{
132 u_int old;
133
134 old = atomic_load_int(count);
135 for (;;) {
136 if (old <= n)
137 return (false);
138 if (__predict_false(REFCOUNT_SATURATED(old)))
139 return (true);
140 if (atomic_fcmpset_int(count, &old, old + 1))
141 return (true);
142 }
143}
144
145static __inline __result_use_check bool
146refcount_acquire_if_not_zero(volatile u_int *count)

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected