refcount – Atomic Reference Counting C API (User)
refcount_add_weak(…) – add reference (basic thread-safety)
#include < refcount.h >
void refcount_add_weak(refcount_t volatile *sloc, int count);
The refcount_add_weak(…) function is used to increment the reference of a refcount_t. This function guarantees that the reference increment operation, if any, is atomic and will strictly adhere to a thread-safety level of basic.
The ‘sloc’ parameter MUST point to a refcount_t object that MUST be acquired by or transferred to the calling thread before it calls into this function. The ‘count’ parameter MUST be a value that is greater than 0. The caller will be subjected to undefined-behavior if the ‘sloc’ or ‘count’ parameters contain any values that violate those rules.
The function WILL always increment the reference count of the reference pointed to by ‘sloc’ by ‘count’.
The refcount_add_weak(…) function will fail if:
[Undefined Behavior] - The values of ‘sloc’ or ‘count’ were invalid.